I am attempting to use JUnit for the first time, but I seem to be having some issues when running my compiled test runner. I am using java from the command-line and running macOS.
I successfully compiled my two jar files and 4 java source files using the following command:
javac -classpath junit-4.12.jar:jar2.jar StackLinkedTestRunner.java 2.java 3.java 4.java
However, when I execute java StackLinkedTestRunner
, I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/runner/JUnitCore at StackLinkedTestRunner.main(StackLinkedTestRunner.java:9) Caused by: java.lang.ClassNotFoundException: org.junit.runner.JUnitCore at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 1 more
I've googled the error, but I really don't understand any of the returned problems or solutions. I would greatly appreciate it if people could please take the time to explain what I'm doing incorrectly and how I can go about fixing it.