2

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?

2
  • The CLASSPATH environment variable is almost never used, you shouldn't try to use it. Commented Aug 1, 2014 at 7:30
  • add the jar to the classpath of your application Commented Aug 1, 2014 at 8:12

2 Answers 2

7

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..

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

4 Comments

is it needed for maven project too?
Worked like a charm! :)
The adding to the Deployment Assembly was what did the trick, thanks bud! :)
I have found many answers. This one is correct.
1

Yes your settings are right 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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.