Make Jar File From Two Classes?

Asked By 30 points N/A Posted on -
qa-featured

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.

SHARE
Best Answer by James20
Best Answer
Best Answer
Answered By 0 points N/A #95760

Make Jar File From Two Classes?

qa-featured

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

 

Answered By 10 points N/A #95761

Make Jar File From Two Classes?

qa-featured
  1. Install netbeans on your pc
  2. Then add all class in one file and make sure that there is only one main class
  3. Create a project
  4. Then create a file
  5. Then add the file
  6. Then click on build solution
  7. Get the jar file on disk folder in the directory where your project located

Hope this will help

Login/Register to Answer

Related Questions