I'm getting ClassNotFoundException on Class.forname("com.mysql.jdbc.Driver")
I'm using Windows Vista 64-bit, Eclipse Galileo, GWT framework. I downloaded mysql-connector-java-5.1.6-bin, but what is the exact path I should put this file in? I'm getting this exception while I'm in gwt-projects, but in normal projects it works good. Any idea how that should be done?
3 Answers
Finally its worked, the problem was not in the classpath, but from the .jar file itself, im using mysql-connector-java-5.1.6-bin which was not working, but when i tried mysql-connector-java-3.0.17-ga-bin everything works good, i hope to fix the new version soon anyway thanks BalusC for helping :)
1 Comment
Just put the JAR file in the runtime classpath of the application in question.
In case of a Servlet based webapplication, you normally put it in /WEB-INF/lib folder. It's by default covered by the webapp's runtime classpath.
3 Comments
.zip file? The download is provided as a .zip. You'll need to extract the .zip and put the included .jar file in the classpath. Also read the instructions at the download page...Disable Google App Engine. Its a setting in Eclipse.
Google App Engine doesn't allow you to open Sockets. When you try to load the JDBC driver, it makes a socket connection in a static block. An exception in the static block leads to a ClassNotFoundException, which is what you are seeing.
CLASSPATHenvironment variable is a bad idea. It's only useful for starters who expect some convenience when programming in CLI. It's never used in real world applications and it's also completely ignored by webapplications (with a good reason!).