Java program accessible by all users

Christofer C. Bell christofer.c.bell at gmail.com
Fri Dec 2 21:57:56 UTC 2005


On 12/2/05, Paul Smith <phhs80 at gmail.com> wrote:
> On 12/2/05, John Summerfied <debian at herakles.homelinux.org> wrote:
> >
> > No. Read your manuals:-)
>
> Sure! Could you please suggest to me the relevant documentation?

Basically, for the purposes of execution, you can pretend that .jar
files are shell scripts that you call an interpreter (in this case
java) to run.  The only caveat is that you can't use the convenient
#!/bin/java notation at the top of the .jar file. ;-)

There is nothing special about jar files, they're basically zip files.
 They're not programs themselves.   Your java interpreter will know
what to do with the contents of the jar file when you use it assuming
the jar was packed correctly, with use by java in mind (remember, it's
just a zip file, the logic for the interpreter is included at archive
creation).

I hope the following pointers are useful.

>From http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html

-jar
    Execute a program encapsulated in a JAR file. The first argument
is the name of a JAR file instead of a startup class name. In order
for this option to work, the manifest of the JAR file must contain a
line of the form Main-Class: classname. Here, classname identifies the
class having the public static void main(String[] args) method that
serves as your application's starting point. See the Jar tool
reference page and the Jar trail of the Java Tutorial for information
about working with Jar files and Jar-file manifests.

    When you use this option, the JAR file is the source of all user
classes, and other user class path settings are ignored.

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

What is Jar?

Jar stands for Java ARchive. It's a file format based on the popular
ZIP file format and is used for aggregating many files into one.
Although Jar can be used as a general archiving tool, the primary
motivation for its development was so that Java applets and their
requisite components (.class files, images and sounds) can be
downloaded to a browser in a single HTTP transaction, rather than
opening a new connection for each piece.

>From http://java.sun.com/docs/books/tutorial/jar/basics/run.html

JAR Files as Applications

    You can run JAR-packaged applications with the Java interpreter.
The basic command is:

java -jar jar-file

    The -jar flag tells the interpreter that the application is
packaged in the JAR file format.

--
Chris

"`The enemy we fight has no respect for human life or human rights.
They don't deserve our sympathy,' he said. `But this isn't about who
they are. This is about who we are. These are the values that
distinguish us from our enemies.' - Sen. John McCain, R-Arizona




More information about the fedora-list mailing list