By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

Problem running jar -- classpath error?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.