Hi I am using maven2 to build my project. I am able to generate the jar file using maven build with the command mvn clean install.
I have added this plugin to my pom.xml for manifest file to make the class path entry and main class to execute:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>com.test.TestExample</mainClass> </manifest> </archive> </configuration> </plugin> When I build the project, and extracted the jar file, its generated manifest.mf file and added the main class entry as : Main-Class: com.test.TestExample and added the jar files to the Class-Path:mail-1.4.jar. But when I am tryign execute the jar file using command java -jar TestJar.jar I am getting the exception :
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException at java.net.URLClassLoader$1.run(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) ... 1 more Any pointer to solve this is very helpful..
Thanks in advance..
D:\jars\mail.jar, I am running through the eclipse, and added the entry into build path for mail.jar using the local path, now i am trying to run through the jar file, its unable to find the mail.jar. How can make the mail.jar file availabe to the jar which i am trying to execute?