I have this class file that is used to send mails. This file requires 2 jars, activation.jar and mail.jar. Both these jars are included in the classpath. This classfile runs perfectly when i run from the cmd or from eclipse.
But my requirement is that i need to make a jar file of the classfile. I have taken all the required steps while creating the jar file. I created a manifest.txt file and it has 2 entries, Main-Class and Class-Path. I have created jars using both cmd and eclipse. When I run the jar file i get the error
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Authenticator
This error i get for both the jars i have created one through cmd and the other through eclipse. javax/mail/Authenticator This class is there in mail.jar, that i have included in the classpath.
I dont know why i am getting this error. When i run this classfile through cmd it runs fine, but when i run the jar file, it gives me the above error.
Please comment. Thanks in advance [ November 08, 2008: Message edited by: Adrian Perry ]
I knew it was something obvious. My jar could not see the other jars. The reason being, there is file called Manifest.txt, in which you specify 2 parameters, in case your jar file has a main class and the path of other jar files that are required to run the main jar file.