Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassNotFoundException

 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have formatted my windows machine and i have installed jdk ,my sql ,eclipse.when i tried to run my program with jdbc connection in eclipse,I found the error:

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

my database connection string is:

I have added the mysqlconnector.jar in the project in eclipse,and i have mentioned the classpath in environmentvariables as "D:\Program Files\java\jdk1.6.0_03\lib\mysql-connector-java-3.0.17-ga-bin.jar"

where am i wrong ?please guide me to solve this

Thanks
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
preethi Ayyappan wrote:
I have added the mysqlconnector.jar in the project in eclipse

You need to add it to the project's buildpath (Eclipse's term for the classpath which is to be used during both compile and runtime). Rightclick project, go to Buildpath and add the JAR file to it.


,and i have mentioned the classpath in environmentvariables as "D:\Program Files\java\jdk1.6.0_03\lib\mysql-connector-java-3.0.17-ga-bin.jar"

The classpath environment variable is totally ignored by Eclipse. It is normally only used by the java.exe when you run it without the -cp or -classpath argument.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic