exec jars w/dependent jars

Discussion in 'Java' started by Ike, Sep 24, 2004.

  1. Ike

    Ike Guest

    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
    Ike, Sep 24, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:HlV4d.76$...
    > 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, Sep 24, 2004
    #2
    1. Advertising

  3. Ike

    John Davison Guest

    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
    John Davison, Sep 24, 2004
    #3
  4. 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/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. ;-)

    --
    Thomas<dot>Fritsch<squiggle>ops<dot>de
    Thomas Fritsch, Sep 24, 2004
    #4
  5. Ike

    Sudsy Guest

    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.
    Sudsy, Sep 24, 2004
    #5
  6. Ike

    Will Hartung Guest

    "Sudsy" <> wrote in message
    news:...
    > 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
    ()
    Will Hartung, Sep 24, 2004
    #6
  7. 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
    Andrew Thompson, Sep 24, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    9,000
  2. JavaEnquirer
    Replies:
    2
    Views:
    499
    JavaEnquirer
    Feb 22, 2006
  3. Hal Vaughan
    Replies:
    11
    Views:
    1,083
    Gordon Beaton
    May 22, 2006
  4. puzzlecracker
    Replies:
    1
    Views:
    503
    James Kanze
    Aug 7, 2008
  5. Ulf Meinhardt
    Replies:
    2
    Views:
    1,383
Loading...

Share This Page