This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a jar file that has two dependent jar files. The files are included in the main jar. When I try to run it, I get "java.lang.NoClassDefFoundError: EZTaxJavaJNI/EZTaxJNI" which is a class inside one of the dependent jar files.
I am running this in the same dir as the jar file. Here is my command line: java -classpath ".;" -jar eztaxTcp.jar 1001 "C:\TWSales Tax 342\EZTaxJavaCpp.dll" "C:\TWSales Tax 342"
I think that when you use the -jar option it ignores the -classpath option as well as the system CLASSPATH variable. In this case, you need to add a Class-Path property to your manifest file to help Java locate the correct classes.
As far as I know, The JRE cannot find jars inside of jars. What you have to do is a Layne said: include a Class-Path attribute in your manifest file.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Joined: Dec 06, 2001
Originally posted by Joel McNary: As far as I know, The JRE cannot find jars inside of jars. What you have to do is a Layne said: include a Class-Path attribute in your manifest file.
And distribute the JARs separately. I just ran into this problem in a recent project. We decided to package all the dependent jars into a zip file and the user would then have to unzip it and put all the jar files into the same folder. Our own JAR had the Class-Path attribute set to find the dependencies if this procedure was followed correctly.