0

I also have the "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" in Eclipse.

I have found many tips and discussions about jdbc in Eclipse, however none of them work so far. I keep reading about a jar file while the official website provides only a zip or tar file.

Does this have anything to do with it?

===============================

What I've tried so far:

  1. sudo apt-get install libmysql-java.

  2. http://dev.mysql.com/downloads/connector/j/ 's tar file, into /usr/lib/jvm/java-6-openjdk/jre/lib/ext

  3. I have no idea how to use a Classpath. But I copied what I could.

  • 1
    And inside the zip or tar file you don't have the .jar? If not probably you are downloading the source code. – Salem Apr 18 '13 at 14:38
  • Wow... Well, I feel stupid... Many thanks, Sir Salem. – dgood1 Apr 18 '13 at 15:05
  • 1
    @Salem - well done - please can you post this as an answer? – fossfreedom Apr 18 '13 at 20:07
  • @dgood1 please mark it as solved or answer your question with the steps you made and mark it as the correct answer. – Salem May 16 '13 at 20:42
0

You need to extract the .jar from that compressed file and add it to Eclipse.

Inside it you will find mysql-connector-java-<version>-bin.jar, which is the jar you are looking for and some other files (like source code and documentation).

Note: package libmysql-java indeed provides the jar you need (it is placed in /usr/share/java/mysql-connector-<version>.jar), so if Eclipse does not find it you may need to change something in "Java Build Path".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.