By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,273 Members | 1,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,273 IT Pros & Developers. It's quick & easy.

Exception in thread "main" java.lang.NoClassDefFoundError

P: 3
I don't why I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError

The statement below works just fine:
java -cp "appframework-1.0.3.jar;swing-worker-1.1.jar";CurrentStrobe.jar com.visionpro.currentstrobe.CurrentStrobeApp

However, the statement below produces the error:
java -cp "appframework-1.0.3.jar;swing-worker-1.1.jar" -jar CurrentStrobe.jar

Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/application/SingleFrameApplication
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknow n Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Caused by: java.lang.ClassNotFoundException:org.jdesktop.appl ication.SingleFrameApplication
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 12 more
Could not find the main class: com.visionpro.currentstrobe.CurrentStrobeApp. Program will exit.

Any ideas?
Sep 26 '08 #1
Share this Question
Share on Google+
4 Replies


100+
P: 539
I've also encountered that one before,

What i did is i've set the classpath inside the Manifest file instead of doing like what you did in the commandline.

try it
Sep 27 '08 #2

P: 3
I was thinking of doing that.

I just wonder why this happens. I've used this syntax before without any problems. I'm sure it's a classpath issue but I don't know why it happens.

They say ignorance is bliss but I hate not understanding why.
Sep 29 '08 #3

Expert 10K+
P: 11,448
I don't why I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError

The statement below works just fine:
java -cp "appframework-1.0.3.jar;swing-worker-1.1.jar";CurrentStrobe.jar com.visionpro.currentstrobe.CurrentStrobeApp

However, the statement below produces the error:
java -cp "appframework-1.0.3.jar;swing-worker-1.1.jar" -jar CurrentStrobe.jar

Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/application/SingleFrameApplication

Any ideas?
In the first version you supply the class where the main() method is to be found:
in class com.visionpro.currentstrobe.CurrentStrobeApp

In the second version your jar tells the JVM to look for the class
org/jdesktop/application/SingleFrameApplication which can not be found by the
JVM. Fix the manifest in in the CurrentStrobe.jar.

kind regards,

Jos
Sep 29 '08 #4

P: 3
The manifest inside the CurrentStrobe jar files read as follows:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 10.0-b19 (Sun Microsystems Inc.)
Main-Class: com.visionpro.currentstrobe.CurrentStrobeApp

I added,

Class-Path: appframework-1.0.3.jar swing-worker-1.1.jar

and now it works just by issuing the following command:

java -jar CurrentStrobe.jar

Thanks for the help...
Sep 29 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.