OS X, Classpath, Eclipse, JAR problems...

A

adam.balgach

Greetings all,

As mentioned in the subject, I am coding on an OS X and using Eclipse
as my IDE. I can create the executable JAR just fine through eclipse,
but when I try and run the JAR from the command line I am getting weird
ClassNotFoundExceptions() however, I am almost 100% sure everything is
set correctly. An external JAR [for mysql DB access] seems to be the
problem...here is the output:

[ab4 ~]$ echo $CLASSPATH
/opt/MySystem/mysql-connector-java-3.1.13-bin.jar

[ab4 /opt/MySystem]$ java -jar System-1_0.jar
[ 10-28-2006 08:39:34 mySystem.SysMain ] WARNING: System Is Starting
up...
[ 10-28-2006 08:39:34 mySystem.SysMain ] ERROR: checkForDB():
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
[ 10-28-2006 08:39:34 mySystem.SysMain ] ERROR: No Database
Detected!...


clearly it can not find the mysql jar [although this runs perfectly
fine, inside of eclipse]

so i tried explicitly stating the mysql jar in the java command line:

[ab4 /opt/MySystem]$ java -classpath
/opt/MySystem/mysql-connector-java-3.1.13-bin.jar -jar System-1_0.jar
[ 10-28-2006 08:39:34 mySystem.SysMain ] WARNING: System Is Starting
up...
[ 10-28-2006 08:39:34 mySystem.SysMain ] ERROR: checkForDB():
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
[ 10-28-2006 08:39:34 mySystem.SysMain ] ERROR: No Database
Detected!...


even when i put the external JAR with the -classpath option it seems to
not be able to find it.


any thoughts on to what I am doing wrong? It seems like its something
minor and/or related to Macs [Tiger 10.4.8] using JDK:

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)


Thanks for all your help.

Cheers,
Adam.
 
A

Andrew Thompson

ClassNotFoundExceptions() .....
[ab4 ~]$ echo $CLASSPATH
/opt/MySystem/mysql-connector-java-3.1.13-bin.jar

[ab4 /opt/MySystem]$ java -jar System-1_0.jar

Comments on a recent thread seemed to suggest the
classpath was ignored once the -jar option was used.
(I am not sure if it applies here)

Andrew T.
 

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,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top