I have two jar files, A.jar and B.jar. A contains my main function and it relies on classes defined in B.
I put A and B in the same folder, which is in the Windows PATH, and try and run my main in A...
java -jar A.jar -dosomething
This gives me a java.lang.NoClassDefFound
error on a method of B that I call in the code underneath -dosomething. Interestingly it has found A.jar and called the main method, but it can't find B.jar, even though it is in the same folder as A.jar.
So I read around (again) about CLASSPATHs and the JAVA_HOME variable and I made sure that my JAVA_HOME is pointing to the right place. This document describes how I should be able to put my extension jar file(s), in my case B, into the /lib/ext folder, so I tred that, but I get the same java.lang.NoClassDefFound
error.
I am using Java jdk1.5.0_10, so for good measure I also placed B.jar in the jre/lib/ext folder underneath there.
So now I have it in three places, the local folder on the PATH, JAVA_HOME/lib/ext and JAVA_HOME/jre/lib/ext and I still get the same error.
Should using lib/ext work? Where on earth have I got to put my B.jar file for this to work properly?