This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcj and cygnus




mark kimsal wrote:

> > There is basically 2 option for the "stupid user" using standard JDKs:
> > - create an executable jar file. It's very simple to do, and the user
> >   just has to double click on the file and it starts like an .exe.
> >   no classpath to set-up.
> >   It's plain simple to create but I'm amazed how few developer do it.
> >   Of course, you need a java 2 runtime...
>
> I've never heard of an executable jar file, how do you create one?

Basically, you add the following line to the manifest file of your
jar file:
Main-Class: com/tapinternet/niceapp/MainClass

It works with both the JRE 1.2 or 1.3. there is also a mechanism
for automatically downloading the needed extensions, but I've
never used it.

Cedric

From http://java.sun.com/j2se/1.3/docs/guide/jar/jarGuide.html:

    On Win32 systems the Java 2 Runtime Environment's installation program
    will register a default association for Jar files so that
double-clicking a
    Jar file on the desktop will automatically run it with javaw -jar.
    Dependent extensions bundled with the application will also be loaded
    automatically. This feature makes the end-user runtime environment
easier
    to use on Win32 systems.

    The Solaris 2.6 kernel has already been extended to recognize the
special
    "magic" number that identifies a Jar file, and to invoke java -jar on
such a
    Jar file as if it were a native Solaris executable. A application
packaged in
    a Jar file can thus be executed directly from the command line or by
    clicking an icon on the CDE desktop.

from http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Main Attributes:

    attribute defined for stand-alone applications
     This attribute is used by stand-alone applications that are bundled
into
    executable jar files which can be invoked by the java runtime directly
    by running "java -jar x.jar".
          Main-Class :
          The value of this attribute defines the relative path of the main
          application class which the launcher will load at startup time.
The value
          must not have the .class extension appended to the class name.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]