Link to home
Start Free TrialLog in
Avatar of chefPeter
chefPeterFlag for Sweden

asked on

Executable Jar File?

How to create an Executable Jar File? Is there any tool to do that? I am using JCreator 1.5. I want to create an
Executable Jar File so it can be used within Windows enviroment. An executable file like the one in JDK 1.3 JFC demo. Please Help, it is urgent!!!
Thanks!
Avatar of Mick Barry
Mick Barry
Flag of Australia image

You just need to add the Main-Class: attribute to you manifest specifying the class to execute.
eg.

Manifest-Version: 1.0
Main-Class: au.com.objects.start.JStart
Created-By: 1.2 (Sun Microsystems Inc.)
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yasser_helmy
yasser_helmy

I use this command:
jar -cmf man.txt prog.jar -C /<program folder> .

This reads from the manifest file man.txt(you can use a path to find the file as /java/prog/man.txt)
the output to file prog.jar
<program folder> this is the folder containing the files to jar
. this means all files in the folder must be added to the jar(you can specify some files as *.class)

The manifest file contents:
Manifest-Version: 1.0
Main-Class: <fully qualified main class name>
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
To be PAQ'ed and points refunded
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
guanwz
I showed chefPeter how to create an executable jar, which is what was asked.
chefPeter:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
the question was answered ages ago.. i think it is better to accept an answer and close it now..
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to objects

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer