Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a JAR file 1

Status
Not open for further replies.

sparafucile17

Programmer
Apr 5, 2002
40
0
0
US
Can anyone explain how to create a Java Archive(JAR)? I'd like to create one, so that the user one has to click on one file to run an application. I got pieces of help from the sun developer site, but not everything.

Here is what I found:
-----------------------
The good news is that the Java 2 Platform now includes an executable JAR file. When you archive your classes, you just need to include the Main-Class parameter in the manifest to tell the JVM where your main method is.

For example, if the main method was in the file, myclass, create a manifest file, for example, mymanifest, with the following lines


Manifest-Version: 1.0
Main-Class: myclass

The JAR file is created as follows:

jar cmf mymanifest myjar myclass.class

You can include other classes in the JAR file by adding them to the end of the command line. To execute this JAR file, called myjar, you can either double click on the myjar icon or use the command java -jar myjar.
-----------------------

Problem is that I don't understand what they mean by a manifest file! (What is it's extension?)

Can anyone Help?

Jeff Tackett
 
Federal,

I too am a C++ programmer struggling through a Java Application! But your link has helped clear things up for me! Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top