Reputation: 1
I compiled a java project which contains implementation as well as junit . I work fine in eclipse. But After converting to jar and Run in Linux terminal it is showing some Exceptions.
I have done the implementation in main class and excecuting the test class by junit.textui.testrunner.run (xyz.class) command
I am getting the exception on running the jar in linux console as NoClassDefFoundError for junit/framework/testcase.
On commenting the junit.textui.testrunner.run (xyz.class) and create a jar of same implementation ,it works fine in console
Upvotes: 0
Views: 99
Reputation: 8946
The jar you created has dependency on junit.jar so download it from here and include it in the classpath while running your jar One more thing as you are using terminal to run the jar
A small note - When you use -jar option, the JAR file is the source of all user classes, and other user class path settings are ignored. That means you cannot use -cp with -jar
Upvotes: 1