This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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:
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.