469,343 Members | 5,388 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

Problem running jar -- classpath error?

I'm having a strange problem running a jar file I created using Eclipse.
The application works correctly inside the IDE -- it compiles, runs,
etc. So I exported it to a jar file and am trying to run it outside the
IDE now. It requires an external jar file.

I'm running it as:

java -classpath path_to_external_jar/extJar.jar -jar myapp.jar

When I do this, I receive a ClassDefNotFound exception for one
of the classes in the external jar. A jar tf extJar.jar shows the
class present in the jar file (which it had to be or it wouldn't have
compiled inside Eclipse.)

Anyone have an idea what's wrong? I've even placed the external
jar in the ext directory for the JRE and it's still not found. I'm
obviously missing something but I'm not sure what.

TIA
Jul 17 '05 #1
3 15430
Did you set up the manifest correctly?

regards,
Dar7yl (the 7 is silent)

"Wolfie" <bg******@gte.net> wrote in message
news:uD*********************@twister.tampabay.rr.c om...
I'm having a strange problem running a jar file I created using Eclipse.
The application works correctly inside the IDE -- it compiles, runs,
etc. So I exported it to a jar file and am trying to run it outside the
IDE now. It requires an external jar file.

I'm running it as:

java -classpath path_to_external_jar/extJar.jar -jar myapp.jar

When I do this, I receive a ClassDefNotFound exception for one
of the classes in the external jar. A jar tf extJar.jar shows the
class present in the jar file (which it had to be or it wouldn't have
compiled inside Eclipse.)

Anyone have an idea what's wrong? I've even placed the external
jar in the ext directory for the JRE and it's still not found. I'm
obviously missing something but I'm not sure what.

TIA

Jul 17 '05 #2
Wolfie wrote:
I'm having a strange problem running a jar file I created using Eclipse.
The application works correctly inside the IDE -- it compiles, runs,
etc. So I exported it to a jar file and am trying to run it outside the
IDE now. It requires an external jar file.

I'm running it as:

java -classpath path_to_external_jar/extJar.jar -jar myapp.jar

When I do this, I receive a ClassDefNotFound exception for one
of the classes in the external jar. A jar tf extJar.jar shows the
class present in the jar file (which it had to be or it wouldn't have
compiled inside Eclipse.)

Anyone have an idea what's wrong? I've even placed the external
jar in the ext directory for the JRE and it's still not found. I'm
obviously missing something but I'm not sure what.


The -classpath option is ignored by the java process when the -jar
option is used. You must specify the classpath in the manifest file of
the jar being run.

Ray
Jul 17 '05 #3
Raymond DeCampo wrote:
The -classpath option is ignored by the java process when the -jar
option is used. You must specify the classpath in the manifest file
of the jar being run.


That doesn't make any sense. I have three jars -- an API to a
database engine, a logging API, and the actual application jar.
The location of the support jars may vary from platform to
platform so I can't hardcode their location.

As it turned out the problem was another java on the path
(presumably Microsoft's) before the installed JSDK. When
I specified the path to the proper java executable, the
problems disappeared. I just love fun like that...
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Peter Bassett | last post: by
7 posts views Thread by Christopher Brandsdal | last post: by
6 posts views Thread by Smutny30 | last post: by
reply views Thread by Jon | last post: by
4 posts views Thread by Chris Dunaway | last post: by
reply views Thread by intution | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.