1

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?

2
  • Did you add it to the CLASSPATH environment variable? Or do you pass it explicitly as argument when you start usual applications? Commented Apr 27, 2010 at 12:31
  • @iPhone: The CLASSPATH environment 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!). Commented Apr 27, 2010 at 12:33

3 Answers 3

1

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 :)

Sign up to request clarification or add additional context in comments.

1 Comment

make this a comment under your question, or edit your question. then upvote or select balusc as the answer
0

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

Im running this code in GWT server side, i added mysql-connector-java-5.1.6-bin to the /WEB-INF/lib for the project, i also restart my IDE but still not working
Is it a .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...
no..its .jar file im sure from the path, but always give me the same exception, i really tried a lot of solutions..but nothing works, thats really weird
0

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.

1 Comment

i was disabling it, but still not working until i change the version for the mysql-connector-java..thanks anyway

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.