NetBeans - find command line and arguments for my Java app?
My Java app needs 3rd party JARs to run. I can't seem to get it to run from the 开发者_开发技巧command line. Its complaining about NoClassDefFoundErrors, despite setting the classpath to what I imagine to be correct. However, when I run it in NetBeans, all is well - it runs as expected. Is there any way to find out the command + arguments NetBeans uses to run my program? This is NetBeans 7.0, BTW.
Should be:
java -jar dist/ProjectName.jar
That uses the META-INF/MANIFEST.MF
file in the jar to determine what to set the class-path to.
First, go to project properties > 'run' and select the main class (one with a main method).
Then make 'clean and build' to generate a jar.
and then execute the jar as this
java -jar dist/yourproject.jar
Or you can double click the jar in windows if you have a JRE installed
Choose Run Menu and Clean and Build Project option Check the output window where you will see one line if text as follows:
To run this application from the command line without Ant, try:
Line below this line will tell you the exact command line which can be used to run this application from command line with absolute path on your machine.
with regards
Tushar Joshi, Nagpur
精彩评论