Thursday, 2 August 2012


How to create jar-file in java by following these 4 steps:

This post will explain you how to create jar file under java:
  • Jar file is java archive file.
  • In Java, we can combine all classes in  .jar ("java archive") file. 
  • You can create your own jar file by combining several classes.
  • After creating, you can run this project anywhere on just double-clicking your .jar file.

Follow the following steps:

  1. Go to your project folder in Bin:


           2.     Compile your java program to create class file


          3.   Note: If compilation is showing single class file then mention that single class file only.
                     If compilation is showing multiple class file then mention all the class files.

          Now, type what is being shown under (for multiple class file generation)
               c = create a JAR file
               f = this shows that the output will go to a file rather than to stdout
               amit.jar = name of jar file generated

          Below command will generate compressed JAR file placed at the same location.

       (above screenshot)
       You can see the number of class files generated after compilation and amit.jar
        file can also be seen here.

       4.       Just double-click on amit.jar file

               In this way you can create jar file in Java.

Please comment and forward to others if you like this.
Other posts with video tutorial yet to come.....
"I am sure that blogs really help people around the world.
Let us follow this simple thinking of sharing knowledge . . ."

No comments:

Post a Comment