[Eclipse] problem with deploying

S

Sean Givan

I'm fairly new to Eclipse and Java programming, and I'm running into a
problem with an application I'm writing.

I have an application that uses the JRE and two external JARs (one for
communication with mySQL and one for playing MP3 files.) When I
launch the application within Eclipse, it knows where to find
everything and launches just fine.

However, when I choose File/Export.. JAR File from the menu, and try
to launch the JAR file from the command line, I get errors. The
program stops with a ClassDefNotFound error when it tries to set a
JDBC driver that it loads by name. Eclipse can find this class from
the 'mysql.jar' I added to the project, but the exported JAR file is
clueless, even with a '.classpath' file included in it.

I tried looking through Eclipse's run configuration dialogs to see if
I could figure out the exact command line it was using, but Eclipse
seems to be hiding it from the user.

Is there a way to find out the command line Eclipse is using? Or
otherwise, how exactly can you run a JAR file that needs to access the
classes of other JAR files?

Thanks,
-Sean Givan
 
D

davidlg

Sean Givan said:
I'm fairly new to Eclipse and Java programming, and I'm running into a
problem with an application I'm writing.

I have an application that uses the JRE and two external JARs (one for
communication with mySQL and one for playing MP3 files.) When I
launch the application within Eclipse, it knows where to find
everything and launches just fine.

However, when I choose File/Export.. JAR File from the menu, and try
to launch the JAR file from the command line, I get errors. The
program stops with a ClassDefNotFound error when it tries to set a
JDBC driver that it loads by name. Eclipse can find this class from
the 'mysql.jar' I added to the project, but the exported JAR file is
clueless, even with a '.classpath' file included in it.

I tried looking through Eclipse's run configuration dialogs to see if
I could figure out the exact command line it was using, but Eclipse
seems to be hiding it from the user.

Is there a way to find out the command line Eclipse is using? Or
otherwise, how exactly can you run a JAR file that needs to access the
classes of other JAR files?

Thanks,
-Sean Givan

Sean, I think you might just need to include the other jar files in your
classpath when you call java. For example:
java -classpath /jdbc/mysql.jar:/jdbc/otherJarThatINeed.jar
com.mypackage.JavaProgram

Does this help? I think in windows you will need to seperate the entries in
your classpath with semicolons (;)

Is this what you are asking?

If you have alread tried this then kindly disregard. Maybe I don't fully
understand your incomplete description of your problem. You could list the
things you have tried and the command line you are trying...

-David
 
D

davidlg

Sean Givan said:
I'm fairly new to Eclipse and Java programming, and I'm running into a
problem with an application I'm writing.

I have an application that uses the JRE and two external JARs (one for
communication with mySQL and one for playing MP3 files.) When I
launch the application within Eclipse, it knows where to find
everything and launches just fine.

However, when I choose File/Export.. JAR File from the menu, and try
to launch the JAR file from the command line, I get errors. The
program stops with a ClassDefNotFound error when it tries to set a
JDBC driver that it loads by name. Eclipse can find this class from
the 'mysql.jar' I added to the project, but the exported JAR file is
clueless, even with a '.classpath' file included in it.

I tried looking through Eclipse's run configuration dialogs to see if
I could figure out the exact command line it was using, but Eclipse
seems to be hiding it from the user.

Is there a way to find out the command line Eclipse is using? Or
otherwise, how exactly can you run a JAR file that needs to access the
classes of other JAR files?

Thanks,
-Sean Givan

Oh yeah, I forgot to ask...What library are you using to play mp3 files?
 
F

Ferenc Hechler

Hi Sean,

If you are using Eclipse 3 then you can use the Fat Jar Eclipse Plug-In.
It collects all files from the Eclipse ClassPath and build one Fat-JAR which
can be executed directly via "java -jar".

Best Regards,

feri
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top