File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic

classpath question

 
Wilson Oak
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Right now I have a class "ShowDataBase" which create a connection to mySQL database. So I put mysql-connector-java-3.1.10-bin.jar and ShowDataBase.class together in one directory. When I run java ShowDataBase,it shows following:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at ShowDataBase.main(ShowDataBase.java:30)


however, if I run "java -cp mysql-connector-java-3.1.10-bin.jar ShowDataBase", it displays:

Exception in thread "main" java.lang.NoClassDefFoundError: ShowDataBase

I am sure the ShowDataBase run correctly until Ecipse and contains no error.
Please help me out for this problem. I don't want to run it under Eclipse very time because it takes a lot memories....
Thx a lot.

[Bear edit: removed shouting!]
[ June 19, 2006: Message edited by: Bear Bibeault ]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post. People are less inclined to offer help when they find that the question they've just answered has already been answered in a different forum.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic