Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.lang.NoClassDefFoundError: javax/mail/Address

807591Apr 24 2008 — edited Apr 24 2008
Hi,
I am working on a simple stand-alone Java app. It has 2 classes: com.company.group.Class1 and com.company.group.Class2. It uses log4j-1.2.15.jar, mail.jar and activation.jar. I have this app configured in eclipse in simplest form. PrjName/src lives all src code inpackages. PrjName/ live all jars and properties file. I am using jdk1.6 and all things are latest and compatible. All the jars have been included in classpath/referenced jars in Eclipse config.

Now when I run the main class from within eclipse, it runs seamlessly without any problem. But when I include the classes in a jar -- MyJar.jar which has com.company.group.Class1 as Main-Class in manifest and then try to execute the app I get the following exception.

Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/
Caused by: java.lang.ClassNotFoundException: javax.mail.Address
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)

I tried following combinations. (All the files are in e:\temp)

java -cp "log4j-1.2.15.jar;mail.jar;activation.jar" -jar MyJar.jar

Please help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 22 2008
Added on Apr 24 2008
6 comments
2,470 views