-1

I have a java file simpleMail.java and a jar file java-mail-1.4.jar (which is used in simpleMail.java). What I want to do is make an executable jar file out of these files and run on cmd.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Anuj Victor
  • 51
  • 2
  • 13

1 Answers1

2

Step 1. create manifest.txt file as Main-Class: Main-Class-Name

Step2. compile all classes.

Step 3. run JDK's jar.exe utility like:

jar cvfm JarName.jar manifest.txt .class cvfm is create a jar; show verbose output; specify the output jar file name; specify the manifest file name. (.class means all class files in the current directory.)

Step 4. specify jar dependency on classpath.

For detail refer http://www.skylit.com/javamethods/faqs/createjar.html

Manvi
  • 1,136
  • 2
  • 18
  • 41