Use when:
1. NoClassDefFoundError and MissingResourceExceptions keep appearing every time an executable jar file is run
2. executable jar files need 3rd party libraries
3. resource folders need to be accessible via classpath
There are two ways to run executable jar files. Which to use depends on how the jar file was constructed.
If the jar file does not need any 3rd party libraries use:
java -jar <jarfile>
If the jar file uses any 3rd party libraries that has not been put inside the archive or needs to have folders accessible via classpath, use:java -cp .;<libraries>;<classpath>;<jarfile> <main-class>
*Note that a folder containing customized Properties files must appear before the main jar file to override any copies inside the archive itself
Wednesday, January 9, 2008
running executable jar files via console
Posted by King Harbromm at 2:54 PM
Tags: java, tip, troubleshooting
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment