exec jars w/dependent jars

I

Ike

if I have an executable jar, H.jar, which also depends on the presence of
another jar (call it depend.jar) in the CLASSPATH, how do I invoke H.jar
from the command line such that it sees depend.jar? Ive looked for docs,
tried many variations such as the one below, to no avail . I'm just trying
to create a windows bat file such that I can zip all the jars, and the bat,
up and send to a client so he can see the status of things. Thanks, Ike

java -jar H.jar -classpath .;depend.jar
 
A

Allen Fogleson

If you know where the jar will reside you can put an entry into the manifest
file that says to include the depend.jar on the classpath. (off the top of
my head....)

CLASSPATH: depend.jar jars/depend2.jar jars/etc.jar

Al
 
J

John Davison

Ike said:
if I have an executable jar, H.jar, which also depends on the presence of
another jar (call it depend.jar) in the CLASSPATH, how do I invoke H.jar
from the command line such that it sees depend.jar? Ive looked for docs,
tried many variations such as the one below, to no avail . I'm just trying
to create a windows bat file such that I can zip all the jars, and the bat,
up and send to a client so he can see the status of things. Thanks, Ike

java -jar H.jar -classpath .;depend.jar

To further extend this question, does java treat the classpath
differently when using the -jar switch? Does it use it at all, or does
it depend solely on the classpath in the manifest?

- john
 
T

Thomas Fritsch

Ike said:
if I have an executable jar, H.jar, which also depends on the presence of
another jar (call it depend.jar) in the CLASSPATH, how do I invoke H.jar
from the command line such that it sees depend.jar? Ive looked for docs,
tried many variations such as the one below, to no avail . I'm just trying
to create a windows bat file such that I can zip all the jars, and the bat,
up and send to a client so he can see the status of things. Thanks, Ike

java -jar H.jar -classpath .;depend.jar
Hi Ike!

Read the doc for "java -jar ..."
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html#-jar
You will find:
"When you use this option, the JAR file is the source of all user
classes, and other user class path settings are ignored."

Further read the JAR File Specification (Main Attributes)
http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Main Attributes
There you find how to specify a Class-Path in the manifest of your H.jar

BTW: I have added the book-mark http://java.sun.com/j2se/1.4.2/docs/ to
my browser, which is really helpful. ;-)
 
S

Sudsy

Thomas Fritsch wrote:
BTW: I have added the book-mark http://java.sun.com/j2se/1.4.2/docs/ to
my browser, which is really helpful. ;-)

A stellar suggestion! I also have
<http://java.sun.com/j2ee/1.4/docs/api/>
When writing Java code, I <em>always</em> have a browser window open
to the javadocs. Even though life is easier with an IDE like Eclipse,
I need to be able to navigate the classes so that I can find methods
in ancestor classes, etc. Since there are sooo many classes, I find
it helpful to be able to browse and locate likely candidates for what
I'm trying to accomplish.
 
W

Will Hartung

Sudsy said:
Thomas Fritsch wrote:


A stellar suggestion! I also have
<http://java.sun.com/j2ee/1.4/docs/api/>
When writing Java code, I <em>always</em> have a browser window open
to the javadocs. Even though life is easier with an IDE like Eclipse,
I need to be able to navigate the classes so that I can find methods
in ancestor classes, etc. Since there are sooo many classes, I find
it helpful to be able to browse and locate likely candidates for what
I'm trying to accomplish.

I have them downloaded and local on my machine. I just wish there was a
process that would integrate the sets of docs.

Not combine them into a monolithic Javadoc, but have the J2EE docs aware of
the Java docs and classes (so, I could click on java.lang.String in the J2EE
docs if I wanted, for example).

Regards,

Will Hartung
([email protected])
 
A

Andrew Thompson

Thomas Fritsch wrote:


A stellar suggestion! I also have
<http://java.sun.com/j2ee/1.4/docs/api/>

When the 1.5 main frames index crashed my OS
component I bookmarked this..
<http://java.sun.com/j2se/1.5.0/docs/api/overview-summary.html>

Then made this..
<http://www.physci.org/api.jsp?class=java.lang.Object>
...handy links for each class. Main page here..
When writing Java code, I <em>always</em> have a browser window open
to the javadocs.

Just one? I have four open at the moment.. Or does your
UA provide advanced functionality such as tabbed browsing. ;-)

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
 

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
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top