I have a program which consists of two simple Java Swing files.
How do I make an executable JAR file for my program?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A jar file is simply a file containing a collection of java files. To make a jar file executable, you need to specify where the
mainClass is in the jar file. Example code would be as follows.Compile your classes. To make a jar, you also need to create a Manifest File (
MANIFEST.MF). For example,Place the compiled output class files (JarExample.class,JarExample$1.class) and the manifest file in the same folder. In the command prompt, go to the folder where your files placed, and create the jar using jar command. For example (if you name your manifest file as jexample.mf)
It will create executable jarexample.jar.