java.lang.NoClassDefFoundError: javax/mail/Address
807591Apr 24 2008 — edited Apr 24 2008Hi,
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.