I'm new to running java from the terminal and am currently trying to run a JUnit test class in terminal. The basic structure of my java classes is
JavaProject
Queue.java
QueueTests.java
junit.jar
RunTests
RunTests is a script with the following code.
#!/bin/sh
javac Queue.java
CLASSPATH=".:junit.jar:"; export CLASSPATH
javac QueueTests.java
java org.junit.runner.JUnitCore QueueTests
However, when I run this, I always get a "Exception in thread "main" java.lang.NoClassDefFoundError" error from the final line. If i comment out the final line, there are no errors. As such, it seems like it is unable to find QueueTests.class. However, looking at the folder, it is clear after I run the script that both Queue.class and QueueTests.class are there. I am not sure what I am doing wrong. Any help would really be appreciated.