Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have installed Eclipse Luna recently to do programming on JSP. Currently i'm trying to connect it with JDBC. I have downloaded mysql J connector and added mysql-connector-java-5.1.31-bin.jar to the build path. I've trying running in on my browser and i get the following error:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

I'm pretty sure that my settings are correct in terms of setting the path. I also have set up the CLASSPATH in environment variables just in case that is the main problem, but still i'm facing the same problem.

Can anyone help me?

share|improve this question

marked as duplicate by BalusC eclipse Oct 9 '15 at 7:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
The CLASSPATH environment variable is almost never used, you shouldn't try to use it. – Mark Rotteveel Aug 1 '14 at 7:30
    
add the jar to the classpath of your application – SparkOn Aug 1 '14 at 8:12

U need to add jar file to build path

right click on project->build path->configure build path->libraries tab ->add external jar

browse it and add it.

after adding also if u not getting same error, then

You must include the jar file in the Deployment Assembly of the Project.......

1)select the web project which contains the jsp file...

 2)select Project tab in the menubar in Eclipse

3)select properties in the drop down menu

4)select Deployment Assembly

5)Add your ojdbc6.jar file in it..

Hope this will help u..

share|improve this answer
    
OMG! Thanks a ton. – Aravind Jan 23 '15 at 13:12
    
is it needed for maven project too? – Krishna Verma Mar 23 '15 at 10:52
    
Worked like a charm! :) – Chaitanya Jun 8 '15 at 17:29
    
The adding to the Deployment Assembly was what did the trick, thanks bud! :) – MPSL Jun 17 '16 at 8:23

Yes your settings are wright for building the application, running it needs other settings. You need to place the jar file either in CATALINA_HOME/lib or in <your-app>/WEB-INF/lib so that the driver is found at run time. The latter is preferable.

share|improve this answer

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