I am using eclipse for creating servlets. I downloaded the mysql-connector-java-5.0.8-bin.jar
(connector/j) and added the jar file to build path of my project. I can use the classes in
mysql-connector-java-5.0.8-bin.jar
(IDE gives me hints and all that stuff and there is no problem using those classes in compile time) . but when i run the servlet i get this error:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
It sounds like suddenly the com.mysql.jdbc.Driver
class that i've been using can not be found!
When i use the jar file for java SE projects it works perfect but it doesn't work with javaEE. How can i fix this?
The database connector jar should be set as the runtime classpath instead of the build paths since database driver is a runtime dependency.