Executable JAR

S

Sharp

Hi

How does one create a java executable JAR file?

any reference that shows how you can do it would be appreciated.

Cheers
Michael
 
A

Andrew Thompson

"Andrew Thompson"
...
Not much detail in the link.

Are you referring to this link,
<http://java.sun.com/developer/Books/javaprogramming/JAR/basics/>
this one,
<http://java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.html>
this one,
<http://groups.google.com/groups?q="make+jar"&scoring=d&meta=group=comp.lang.java.*>
or this one
<http://groups.google.com/groups?q="create+jar"&scoring=d&meta=group=comp.lang.java.*>
?

All of which were linked from that short section. But to clarify.
Did you realise there *were* links from that section?
How do you create an executable JAR using Java webstart?

You do not. JWS requires a Jar (note it is not an acronym) file
but the Jar file does *not* need a manifest, in fact, the main class
specified in the JNLP file can *override* the manifest that exists in
the Jar itself.

You need to clarify first what you want.

Jar'ing your classes and adding a manifest allows them
to be 'double click' launched.

By Jar'ing your classes and using JWS to install them, you get..
- for applications and applets
- launch from menu/desktop icon
- automatic update
- JRE versioning
- splash screeen..

'Unsigned' JWS applications and applets operate within a security
sandbox, but by signing the classes (and the user accepting your
signature) your app. can regain full privileges.

[ Or, might want 'both'. ]

HTH
 
T

Thomas Kellerer

Andrew Thompson wrote on 16.01.2005 13:39:
JWS requires a Jar (note it is not an acronym)

I always thought that jar was the abbreviation for Java ARchive

Thomas
 
S

Sudsy

Thomas said:
Andrew Thompson wrote on 16.01.2005 13:39:



I always thought that jar was the abbreviation for Java ARchive

Thomas,
You're right, Andrew was wrong (for a change).
 
A

Andrew Thompson

Thomas,
You're right, Andrew was wrong (for a change).

There you go.

I actually thought it was based on a "Coffee Container".
Which.. I put mine in a "Coffee Jar".
[ You know - "Chock full'o'Java"? ;-) ]

Thanks for clearing that up.
 
S

Sharp

--


---
M i c h a e l
Match.com members may contact me
directly on (e-mail address removed)
Andrew Thompson said:
Are you referring to this link,
<http://java.sun.com/developer/Books/javaprogramming/JAR/basics/>
this one,
<http://java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.htm
l>
this one,
<http://groups.google.com/groups?q="make+jar"&scoring=d&meta=group=comp.lang
..java.*>
or this one
<http://groups.google.com/groups?q="create+jar"&scoring=d&meta=group=comp.la
ng.java.*>
?

All of which were linked from that short section. But to clarify.
Did you realise there *were* links from that section?


You do not. JWS requires a Jar (note it is not an acronym) file
but the Jar file does *not* need a manifest, in fact, the main class
specified in the JNLP file can *override* the manifest that exists in
the Jar itself.

I'm trying to create an executable jar.
I'm using Java 1.4
At MS command prompt I type 'java', and get:

Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions

As you can see jar command is not listed.
Indeed, typing 'jar' at command line shows 'jar is not a recognised
command'.

Whats the deal?

Cheers
Michael
 
T

Thomas Kellerer

Thomas,
You're right, Andrew was wrong (for a change).


There you go.

I actually thought it was based on a "Coffee Container".
Which.. I put mine in a "Coffee Jar".
[ You know - "Chock full'o'Java"? ;-) ]

Thanks for clearing that up.

I do think this duplicate meaning is intended :)

Cheers
Thomas
 
S

Sharp

Andrew Thompson said:
<http://java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.htm
l>
this one,
<http://groups.google.com/groups?q="make+jar"&scoring=d&meta=group=comp.lang
.java.*>
or this one
<http://groups.google.com/groups?q="create+jar"&scoring=d&meta=group=comp.la
ng.java.*>
?

All of which were linked from that short section. But to clarify.
Did you realise there *were* links from that section?


You do not. JWS requires a Jar (note it is not an acronym) file
but the Jar file does *not* need a manifest, in fact, the main class
specified in the JNLP file can *override* the manifest that exists in
the Jar itself.

I'm trying to create an executable jar.
I'm using Java 1.4
At MS command prompt I type 'java', and get:

Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions

As you can see jar command is not listed.
Indeed, typing 'jar' at command line shows 'jar is not a recognised
command'.

Whats the deal?

Cheers
Michael

I solved the problem by setting a class path to the bin directory in the JDK
directory.
I typed:
set path=c:\jdk1.4.1_02\bin;%PATH%
Problem this is only temporary for this session.
Any ideas of making it permanent?

Cheers
Michael
 
S

Sharp

I'm trying to create an executable jar.
I'm using Java 1.4
At MS command prompt I type 'java', and get:

Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions

As you can see jar command is not listed.
Indeed, typing 'jar' at command line shows 'jar is not a recognised
command'.

Whats the deal?

Cheers
Michael

I solved the problem by setting a class path to the bin directory in the JDK
directory.
I typed:
set path=c:\jdk1.4.1_02\bin;%PATH%
Problem this is only temporary for this session.
Any ideas of making it permanent?

Cheers
Michael

It also appears that you have to include src.jar, which includes the class
files that may be used in the program.
I guess this is done by using extensions in jar command.
It appears to be alot of work involved in getting an exe jar up and running.
Surely there must be an automated tool to do this?

Cheers
Michael
 
S

Sudsy

Thomas said:
On 17.01.2005 09:19 Andrew Thompson wrote:
There you go.

I actually thought it was based on a "Coffee Container".
Which.. I put mine in a "Coffee Jar".
[ You know - "Chock full'o'Java"? ;-) ]

Thanks for clearing that up.
I do think this duplicate meaning is intended :)

But then how do you justify war (Web ARchive) and ear (Enterprise
ARchive)?
 
T

Thomas Kellerer

Thomas said:
On 17.01.2005 09:19 Andrew Thompson wrote:
There you go.
I actually thought it was based on a "Coffee Container".
Which.. I put mine in a "Coffee Jar". [ You know - "Chock
full'o'Java"? ;-) ]

Thanks for clearing that up.
I do think this duplicate meaning is intended :)


But then how do you justify war (Web ARchive) and ear (Enterprise
ARchive)?

Who said we have to :)
 
A

Ann

It also appears that you have to include src.jar, which includes the class
files that may be used in the program.
I guess this is done by using extensions in jar command.
It appears to be alot of work involved in getting an exe jar up and running.
Surely there must be an automated tool to do this?

I needed to add only "c:\j2sdk1.4.2\bin" to my path.
You can set it in:
START -> CONTROL PANEL -> SYSTEM -> Advanced tab -> Environment Variables
 
A

Andrew Thompson

On Wed, 19 Jan 2005 19:25:47 +0100, DR wrote:

Please refrain from top-posting.
<http://www.physci.org/codes/javafaq.jsp#netiquette>

Se further comments below

From the description, as crudely translated from French..

"JavaExe makes it possible to launch a Java application starting
from an achievable file under Windows and to associate its own icon it.
Windows will be able to thus handle your Java application as well as any
other application, such as for example associating a type of file your Java
application, or of launching your application since the Démarrer menu..."

Given that JWS does all that, and also..
- works for Mac and Linux,
- can throw in a splash screen,
- offers auto-update and
- is made and maintained by the experts (Sun),
...what is it exactly about 'JavaExe' that makes you recommend it?

What does JavaExe offer that is not already covered by JWS?
 
S

Sharp

Please refrain from top-posting.
<http://www.physci.org/codes/javafaq.jsp#netiquette>

Se further comments below
http://www.01net.com/telecharger/windows/Programmation/java/fiches/24639.htm
l

From the description, as crudely translated from French..

"JavaExe makes it possible to launch a Java application starting
from an achievable file under Windows and to associate its own icon it.
Windows will be able to thus handle your Java application as well as any
other application, such as for example associating a type of file your Java
application, or of launching your application since the Démarrer menu..."

Given that JWS does all that, and also..
- works for Mac and Linux,
- can throw in a splash screen,
- offers auto-update and
- is made and maintained by the experts (Sun),
..what is it exactly about 'JavaExe' that makes you recommend it?

What does JavaExe offer that is not already covered by JWS?

JWS requires jar files to be signed.
JWS requires a web server.

I just want to be able to deploy my java programs on any computer by CD.
I can't afford to buy a web server to host my programs.
Not to mention the internet costs.

Regards
Michael
 
A

Andrew Thompson

JWS requires jar files to be signed.

If they require unrestricted access to the user's PC, yes.

That does not cost anything if you use a 'self-signed' certificate.
E.G. said:
JWS requires a web server.

JWS can work off the web or CD (though I have not tried the
CD side of it because it makes so little sense[1])
I just want to be able to deploy my java programs on any computer by CD.

That requires a CD drive on the target PC.
( Yes, of course 'web delivery' requires an internet connection,
I am simply pointing out that 'CD' is not a solution for *every* PC
or other device capable of running J2SE )

It also costs, for every CD..
- burning
(- printing)
- packaging
- delivery..
I can't afford to buy a web server to host my programs.

GeoCities costs nothing. Nada, zero.. not a penny.

There are many other free web hosts.
Not to mention the internet costs.

0$

[1] So ultimately, delivery using web-start off an 'ad sponsored'
site on the internet costs you the time and effort to set it up,
and that is it. It is a much cheaper alternative that CDs for
anything but a handful of copies (end even then you can still use JWS).

The advantage to delivery off a site is that when you upload a new
jar file, the end user's applications get upgraded automatically.

But you still have not addressed an important matter
(unless I missed it).

Are you creating software for Windows users only? If so,
why are you using Java rather than a language more closely
geared to Windows, like .NET?
 

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,262
Messages
2,571,052
Members
48,769
Latest member
Clifft

Latest Threads

Top