Reputation: 53
Ive been playing with junit over the past few weeks and Ive switched to a diffrent machine and for the life of me I cannot get JUnit to run successfully. This is the error that eclipse is giving me:
java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:333)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadTestLoaderClass(RemoteTestRunner.java:380)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:370)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:365)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:309)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:224)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:208)
Caused by: java.lang.ClassNotFoundException: org.junit.runner.manipulation.Filter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more
I have my environment variables set correctly; JUNIT_HOME [points to c:/junit-4.10.jar] and CLASSPATH [points to %CLASSPATH%;%JUNIT_HOME%\JUnit4.10.jar;.;]
I hope someone can help me out with this, thanks!!
Upvotes: 2
Views: 186
Reputation: 53
I managed to fix the issue, I had to go to java-->build path and I removed the .jar and the junit library from modulepath, I then added only the junit library under classpath and it works fine now; I am still confused, when I add the junit library it says source not found.
Upvotes: 1
Reputation: 652
It looks like you are using the wrong version of JUnit and it doesn't have the classes or methods you are expecting.
Upvotes: 0