472,133 Members | 1,020 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

Exception in thread "main" java.lang.NoClassDefFoundError

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
4 14517
sukatoa
539 512MB
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
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
JosAH
11,448 Expert 8TB
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
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.

Similar topics

7 posts views Thread by news | last post: by
9 posts views Thread by tiyaramunna | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.