"No junit.jar" exception while running tests in IDEA 2021.3.3 Community Edition
Answered
I m trying to run Kotlin project's tests in IDEA 2021.3.3 Community Edition (debian Linux),
I got the error "No junit.jar" at small red window at the left bottom corner, and the following stack trace in the console:
com.intellij.execution.junit.JUnitUtil$NoJUnitException: No junit.jar
at com.intellij.execution.junit.JUnitUtil.checkTestCase(JUnitUtil.java:393)
at com.intellij.execution.junit.TestPackage.createJavaParameters(TestPackage.java:230)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:865)
at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:61)
at com.intellij.execution.configurations.JavaCommandLineState.getJavaParameters(JavaCommandLineState.java:44)
at com.intellij.execution.impl.DefaultJavaProgramRunner.patchJavaCommandLineParams(DefaultJavaProgramRunner.java:137)
at com.intellij.execution.impl.DefaultJavaProgramRunner.lambda$doExecuteAsync$5(DefaultJavaProgramRunner.java:163)
at com.intellij.execution.target.TargetEnvironmentAwareRunProfileState$1.run(TargetEnvironmentAwareRunProfileState.java:58)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:436)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:120)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:496)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:244)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1764)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:832)
In the same time some tests from the sub-module of same project runs well (module integration_test for example) , could you tell what is going on?
Please sign in to leave a comment.
What is the JUnit version? What run configuration do you use?
The error means that there are no Junit library in the classpath. Please check that the Junit dependency is configured in module.
Version junit-jupiter 5.7.2 this I can see in "Project Structure -> Project Settings -> Libraries" But I can't find "junit" string in any pom.xml of the entire project. Some of modules tests works, but root one - doesn't. This is the tests configuration https://ibb.co/2sSnY27 I do not know what to do with that, could you tell me?
PS: I recorded the video for your better understand, please take a look https://ibb.co/LS95PCN
I'm very sorry for a delayed reply. Please change the Run Configuration option from In single module to In whole project.
Hello I faced same issue in Intellij 2022.3.1 (Community edition).
For fix it go to test Run configuration => Modify options => Search for tests => and select In whole project instead of (In signle module) and it works !