Search code examples
intellij-ideajunit

"No junit.jar" exception while running tests in IDEA 2021.3.3 Community Edition


I m trying to run Kotlin project's tests in IDEA 2021.3.3 Community Edition (debian Linux), please take a look at video https://ibb.co/cb8jhfW I got the error "No junit.jar" 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?

UPD I have recorded the video of my problem, please take a look https://ibb.co/LS95PCN


Solution

  • It seems that parent module has no tests itself, and no attached junit as well. You can change your run configuration to search 'in whole project' (acc to video, you have 'In single module'), then IDEA should find all tests.

    change to whole project