executing a jar

  • Thread starter Lloyd Harlow Yap via JavaKB.com
  • Start date
T

T.

Lloyd said:
how to make a executable jar files

I'd Google on Manifest-files. You have to create a jar (with the
commandline jar tool that is included in the JDK) that contains your
classfiles (in directories that match the packages) and a directory
MANIFEST. That dir contains the manifest-file (google!) with the
classpath and the main class.


T.
 
M

Malte

Lloyd said:
how to make a executable jar files

If you do not have a tool, this will work (assumes *ix terminal). On
Windows you could probably right mouse click on something in the filemanger:

1. jar cvf myjar.jar myclass.class

2. jar -xf myjar.jar

3. cp META-INF/MANIFEST.MF .

4. vi MANIFEST.MF

5. add this line

Main-Class: mypackage.Class1

or whatever class in the package has the main method

5. jar -cvmf MANIFEST.MF myjar.jar myclass.class

java -jar myjar.jar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top