Multiple JAR files on command line?

X

xarax

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?
 
D

David Zimmerman

xarax said:
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.
 
J

Joseph Millar

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
 
X

xarax

Joseph Millar said:
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.
 
R

Roedy Green

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?
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top