Reputation: 1323
Following up on one of my questions in another post.
I added the maven-assembly-plugin
to my POM
, and now the jar works, but only if I double-click on the jar in the file system. If I try to run the jar from the command line, I still receive this error:
Exception in thread "main" java.lang.NoClassDefFoundError:
This concerns me, because it seems like this jar is not platform-independent. How can I fix this?
Upvotes: 0
Views: 359
Reputation: 1177
That should not happen as launching it through command line is the exact same as launching by double click. Maybe you are trying to get it to use a different version of java through command line and that is what isn't working? to clarify, the command to launch a jar is java -jar name.jar
Upvotes: 1
Reputation: 1125
syntax to launch application from jar on cmd line
java -jar jarname
Given that you have Manifest.txt file with jar having Main-Class:*package.class_name_containing_main_method*
Upvotes: 2
Reputation: 420931
How do you launch it?
You need to use the -jar
switch:
java -jar your_jarfile.jar
Upvotes: 2