I am writing a Swing desktop application. I will compile my program using:
C: \ MyJavaPrograms \ src> "C: \ Program Files \ Java \ jdk1.7.0_04 \ bin \ javac" SVNTool.java -cp ".; C: \ parsers \ commons \ commons-lang-2.4.jar; C: \ parsers \ svnkit-1.7.4-v1 \ lib \ svnkit-kli-1.7.4-v1.jar; C: \ parsers \ svnkit-1.7.4-v1 \ lib \ svnkit-1.7.4-v1.jar "
and I call my program using:
C: \ MyJavaPrograms \ src> "C: \ Program Files \ Java \ jdk1.7.0_04 \ bin \ java" SVNTool -cp ".; C: \ parsers \ commons \ commons-lang-2.4.jar; C: \ parsers \ svnkit-1.7.4-v1 \ Lib \ svnkit-kli-1.7.4-v1.jar; C: \ parsers \ svnkit-1.7.4-v1 \ Lib \ svnkit-1.7.4-v1.jar "
It compiles fine. It starts off normally. But when I click on the button, it creates a SwingWorker stream, but this stream failed with NoClassDefFoundError.
I searched the network and was able to work around the problem by adding some jar files to the CLASSPATH environment variable using:
C: \ MyJavaPrograms \ src> set CLASSPATH =% CLASSPATH%; C: \ parsers \ svnkit-1.7.4-v1 \ lib \ svnkit-1.7.4-v1.jar; C: \ parsers \ svnkit-1.7 0,4-v1 \ lib \ svnkit-kli-1.7.4-v1.jar; C: \ parsers \\ Commons Wikimedia Commons Leng-2.4.jar
So, what leads to a class path mismatch between compile time and runtime in a multi-threaded Swing application? Is there a way to make all environment variables and command line options available to threads?
Khai source
share