N/APosted on - 07/30/2011
Guide me how can I make jar file in Java.
Take 2 classes (Assignment_2. class and Voter.class ) and tell me how can I make jar file from these two classes Using Command Prompt.
Please give me its screen shots or provide me some video tutorial so that I can understand its concept easily.
Make Jar File From Two Classes?
Here is the format to use the jar utility to make jar files.
jar cf jar-file input-file(s)
Suppose two classes are (Assignment_2. class and Voter.class) and I want to put them in the jar file. I want to put them in A2.jar
First create a text file with notepad here, name it as manifest.mf, note that I have saved the text file with the extension .mf, not .txt
In this text file I will provide the various parameters for the jar file. One important parameter is to tell about the file containing the main method.
Save this text file. Issue the command as jar cvfm A2.jar manifest.mf Assignment_2.class Voter.class
A2.jar will be created. Now to run the jar we have just created file I will issue command as A2.jar