- First, make sure you have installed Java 1.2 or above. This facility is not available in previous versions of Java.
- Now create a program and place it in a separate folder.For example the main class is hello world. so first compile it using the statement
javac helloworld.java - Now you will find a file named helloworld.class
- Now in that same folder you create a file Manifest.mf
- The first line should be --- Main-Class: helloworld
- Now save the file
- Now open the command promt in that folder.
- Type the line --- jar cfm helloworld.jar Manifest.mf *.class
- Give enter and your jar file would be created.
- If you have gif images used in the program then place the images in that folder and type the given line in the commandline ---- jar cfm helloworld.jar Manifest.mf *.class *.gif
- Now your jar is created .Click on it to run it.
- Note :: all the commands and file name are case sensitive.
Search This Blog
Monday, June 28, 2010
How to create a jar file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment