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.
Thanks.
Answered By
James20
5 points
N/A
#95760
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)
Â
e. g.
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
Â