
Signature
Knute Johnson
email s/nospam/knute/
dan wrote:
>> Oddly I am unable to execute my jar directly (without getting an
>> exception); however, by specifying the class directly it runs just
[quoted text clipped - 3 lines]
>> properties .. it is behaving as if my classpath is being corrupted
>> when I use the -jar flag.
When run with "-jar", the "java" command ignores any external classpath and
looks only in the JAR manifest for its class paths.
<http://java.sun.com/docs/books/tutorial/deployment/jar/run.html>:
> The -jar flag tells the interpreter that the application is packaged in the JAR file format.
> You can only specify one JAR file, which must contain all the application-specific code.
and <http://java.sun.com/j2se/1.4.2/docs/tooldocs/findingclasses.html>:
> The user class path is specified as ...
> The JAR archive specified by the -jar option, which overrides all other values.
> If this option is used, all user classes come from the specified archive.
...
> A JAR file usually contains a "manifest" -- a file which lists the contents of the JAR.
> The manifest can define a JAR-class-path, which further extends the class path
> (but only while loading classes from that JAR).

Signature
Lew
dan - 01 Jun 2007 03:52 GMT
> dan wrote:
> >> Oddly I am unable to execute my jar directly (without getting an
[quoted text clipped - 25 lines]
> --
> Lew
Thanks Lew, you hit the nail on the head. I guess there is more to a
jar than I had originally thought. For my project I guess I don't
need to create the executable jar; I'm not distributing a jar and I
have full control over the environment. I appreciate the quick and
thorough response.
Lew - 01 Jun 2007 15:00 GMT
> I appreciate the quick and thorough response.
No problem. It didn't take me very long googling around, given that I knew we
were dealing with "Java JAR classpath"s, to come up with the information. And
of course, all I did was quote the material I found; it's not like I needed to
be especially knowledgeable.

Signature
Lew