Automated tool for exe jar

S

Sharp

Hi

Can someone recommend me a tool that will create an executable jar?

Thanks
Michael
 
A

AlexKay

Sharp said:
Hi

Can someone recommend me a tool that will create an executable jar?

Hi, I'll try posting something but it seems like google ate my other post?

Anyway to automate, probably the only thing you need is a batch file for
windows or a shell script for unix. All you need to do is

0. Have a correct CLASSPATH

1. Create a one line file (lets call it "manifest.stub") to tell the JAR
what main is.
Main-Class: HelloWorld

2. Create the jar.
jar cvmf manifest.stub myExy.jar HelloWorld.class

cvmf is:-
c) create
v) verbose
m) manifest file name
f) jar file name

3. Run it
java -jar myExy.jar

To automate just parametize the above and you're ready to go.

HTH
Alex
 
S

Sharp

Hi
Hi, I'll try posting something but it seems like google ate my other post?

Anyway to automate, probably the only thing you need is a batch file for
windows or a shell script for unix. All you need to do is

0. Have a correct CLASSPATH

1. Create a one line file (lets call it "manifest.stub") to tell the JAR
what main is.
Main-Class: HelloWorld

2. Create the jar.
jar cvmf manifest.stub myExy.jar HelloWorld.class

cvmf is:-
c) create
v) verbose
m) manifest file name
f) jar file name

3. Run it
java -jar myExy.jar

Shouldn't it be double-clickable since you provided a manifest file, which
indicated the main-class?

To automate just parametize the above and you're ready to go.

HTH
Alex


REgards
Michael
 
A

AlexKay

[SNIP]
Shouldn't it be double-clickable since you provided a manifest file, which
indicated the main-class?

Hi,

Gotta be brief, going away ...

Yes it is certainly doable.

1. To be double clickable your Java environment must be setup.

Look in /Start/ControlPanel/System/EnvironmentVariables/System
Variables
Setup your CLASSPATH and also ensure Java's BIN directory is in PATH, I
also set JAVA_HOME ...

OR

2. You can create a batch file in the appropriate directory which sets
up your CLASSPATH, PATH, JAVA_HOME etc and then it can call java -jar
myExy.jar

Cheers.
Gotta fly.
 
T

Thomas Kellerer

1. To be double clickable your Java environment must be setup.

Look in /Start/ControlPanel/System/EnvironmentVariables/System
Variables
Setup your CLASSPATH and also ensure Java's BIN directory is in PATH, I
also set JAVA_HOME ...

OR

2. You can create a batch file in the appropriate directory which sets
up your CLASSPATH, PATH, JAVA_HOME etc and then it can call java -jar
myExy.jar

Cheers.
Gotta fly.

CLASSPATH variable is never necessary (it was with 1.2, but since 1.3 it is not
any more). You should either use the -cp switch in your batch file, or specify
the classpath in the manifest for the executable jar. JAVA_HOME is not necessary
either. The newer JDKs can get that from their installation. AFAIK it is only
necessary for Ant to find the JDK to be used.

Thomas
 
S

Sharp

CLASSPATH variable is never necessary (it was with 1.2, but since 1.3 it is not
any more). You should either use the -cp switch in your batch file, or specify
the classpath in the manifest for the executable jar. JAVA_HOME is not necessary
either. The newer JDKs can get that from their installation. AFAIK it is only
necessary for Ant to find the JDK to be used.

Thomas

Excellent.
You mentioned you don't need to set up classpath, but you mention it needs
to be specified in the manifest file?
Maybe you mean to specify the path variable in the manifest file?
In either event, how do you specify it in the manifest file?

Cheers
Michael
 
T

Thomas Kellerer

Excellent.
You mentioned you don't need to set up classpath, but you mention it needs
to be specified in the manifest file?
Maybe you mean to specify the path variable in the manifest file?
In either event, how do you specify it in the manifest file?

A "classpath" definition will always be necessary :)
You just don't need the environment variable (at least on OS level)

You might want to have a look at the jar file specification

http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html

and the JAR files tutorial:

http://java.sun.com/docs/books/tutorial/jar/index.html

This can all be automated quite nicely with Ant:

http://ant.apache.org/manual/CoreTasks/jar.html

Regards
Thomas
 
S

Sharp

message news:[email protected]...
A "classpath" definition will always be necessary :)
You just don't need the environment variable (at least on OS level)

You might want to have a look at the jar file specification

http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html

and the JAR files tutorial:

http://java.sun.com/docs/books/tutorial/jar/index.html

This can all be automated quite nicely with Ant:

http://ant.apache.org/manual/CoreTasks/jar.html

Regards
Thomas

What is Ant?

Cheers
Michael
 

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
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top