Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
adam.balgach@gmail.com - 28 Oct 2006 13:42 GMT
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.
Andrew Thompson - 28 Oct 2006 17:04 GMT
....
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.