Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   exec jars w/dependent jars (http://www.velocityreviews.com/forums/t137149-exec-jars-w-dependent-jars.html)

Ike 09-24-2004 01:32 PM

exec jars w/dependent jars
 
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



Allen Fogleson 09-24-2004 02:41 PM

Re: exec jars w/dependent jars
 
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


"Ike" <rxv@hotmail.com> wrote in message
news:HlV4d.76$Ki1.73@newsread2.news.atl.earthlink. net...
> 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
>
>




John Davison 09-24-2004 03:02 PM

Re: exec jars w/dependent jars (furthermore)
 
Ike wrote:
> 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

Thomas Fritsch 09-24-2004 03:26 PM

Re: exec jars w/dependent jars
 
Ike wrote:
> 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/...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/...n%20Attributes
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. ;-)

--
Thomas<dot>Fritsch<squiggle>ops<dot>de


Sudsy 09-24-2004 04:23 PM

Re: exec jars w/dependent jars
 
Thomas Fritsch wrote:
<snip>
> 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.


Will Hartung 09-24-2004 05:49 PM

Re: exec jars w/dependent jars
 
"Sudsy" <bitbucket44@hotmail.com> wrote in message
news:415449FE.7090109@hotmail.com...
> Thomas Fritsch wrote:
> <snip>
> > 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.


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
(willh@msoft.com)




Andrew Thompson 09-24-2004 06:03 PM

Re: exec jars w/dependent jars
 
On Fri, 24 Sep 2004 12:23:26 -0400, Sudsy wrote:

> Thomas Fritsch wrote:
> <snip>
>> 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 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..
<http://www.physci.org/api.jsp>

> 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


All times are GMT. The time now is 05:01 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.