Multiple JAR files on command line?

Discussion in 'Java' started by xarax, Aug 10, 2003.

  1. xarax

    xarax Guest

    WindowsXP: I am unable to persuade 'java.exe' to include a JAR file in
    the classpath. My DOS window is open and set to the correct directory.
    I tried stuff like this:

    ======================
    java -cp . -jar Btnzdbg.jar

    and:

    java -cp kunststoff.jar -jar Btnzdbg.jar
    ======================

    The Btnzdbg.jar loads and runs fine, but when it tries
    to refer to anything in the kunststoff.jar file, it
    cannot find it.

    The manifest file in Btnzdbg.jar is a very simple
    file (no sealing) that specifies where to find the
    main class file, which gets loaded and runs fine
    until it tries to access classes in the kunststoff.jar
    file.

    When I run the application under the Forte IDE, it runs fine.

    What am I doing wrong?
     
    xarax, Aug 10, 2003
    #1
    1. Advertising

  2. xarax wrote:
    > WindowsXP: I am unable to persuade 'java.exe' to include a JAR file in
    > the classpath. My DOS window is open and set to the correct directory.
    > I tried stuff like this:
    >
    > ======================
    > java -cp . -jar Btnzdbg.jar
    >
    > and:
    >
    > java -cp kunststoff.jar -jar Btnzdbg.jar
    > ======================
    >


    The -jar option means that the classpath will be ignored. If you're jar
    needs 'kunststoff.jar' you'll need to add it to the classpath in the
    manifest.
     
    David Zimmerman, Aug 10, 2003
    #2
    1. Advertising

  3. On 10 Aug 2003 10:00:21 -0700, (xarax) wrote:

    > WindowsXP: I am unable to persuade 'java.exe' to include a JAR file in
    > the classpath. My DOS window is open and set to the correct directory.
    > I tried stuff like this:
    >
    > ======================
    > java -cp . -jar Btnzdbg.jar
    >
    > and:
    >
    > java -cp kunststoff.jar -jar Btnzdbg.jar
    > ======================
    >
    > The Btnzdbg.jar loads and runs fine, but when it tries
    > to refer to anything in the kunststoff.jar file, it
    > cannot find it.


    If you provide -jar on the command line, -cp and -classpath are
    ignored. If your jar Btnzdbg.jar uses kunststoff.jar, then in
    the manifest for Btnzdbg.jar, add the following line:

    Class-Path: kunststoff.jar

    For further info on this, see the Java Tutorial and Jar File Spec.

    --Joe
     
    Joseph Millar, Aug 10, 2003
    #3
  4. xarax

    xarax Guest

    Joseph Millar <> wrote in message news:<>...
    > On 10 Aug 2003 10:00:21 -0700, (xarax) wrote:
    >
    > > WindowsXP: I am unable to persuade 'java.exe' to include a JAR file in
    > > the classpath. My DOS window is open and set to the correct directory.
    > > I tried stuff like this:
    > >
    > > ======================
    > > java -cp . -jar Btnzdbg.jar
    > >
    > > and:
    > >
    > > java -cp kunststoff.jar -jar Btnzdbg.jar
    > > ======================
    > >
    > > The Btnzdbg.jar loads and runs fine, but when it tries
    > > to refer to anything in the kunststoff.jar file, it
    > > cannot find it.

    >
    > If you provide -jar on the command line, -cp and -classpath are
    > ignored. If your jar Btnzdbg.jar uses kunststoff.jar, then in
    > the manifest for Btnzdbg.jar, add the following line:
    >
    > Class-Path: kunststoff.jar
    >
    > For further info on this, see the Java Tutorial and Jar File Spec.
    >
    > --Joe


    Thanks. I looked at the Java Tut for jars, but didn't
    notice the manifest thing for classpath.
     
    xarax, Aug 10, 2003
    #4
  5. xarax

    Roedy Green Guest

    On 10 Aug 2003 10:00:21 -0700, (xarax) wrote or quoted
    :

    >java -cp kunststoff.jar -jar Btnzdbg.jar


    I presume kunststoff.jar and Btnzdbg.jar
    are in the current directory, and both are spelled correctly including
    case?

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Aug 14, 2003
    #5
  6. xarax

    Roedy Green Guest

    Roedy Green, Aug 14, 2003
    #6
    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. Eric McIntyre

    Jar files in Jar files

    Eric McIntyre, May 24, 2004, in forum: Java
    Replies:
    1
    Views:
    479
    Roedy Green
    May 24, 2004
  2. Arnold Peters
    Replies:
    0
    Views:
    587
    Arnold Peters
    Jan 5, 2005
  3. muttley
    Replies:
    0
    Views:
    2,731
    muttley
    Oct 20, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,773
    Roedy Green
    Feb 14, 2006
  5. Arnold Peters
    Replies:
    0
    Views:
    670
    Arnold Peters
    Jan 5, 2005
Loading...

Share This Page