| Author |
mysql connector Class NotFound error
|
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 689
|
|
in my servlet there is a database connection.
if i put mysql connector.jar file to the lib folder in web.INF derectory then it is working.
but if i set the buildPath to the mysql connector using configureBuildPath it says class NotFound error?
|
 |
Vinod K Singh
Ranch Hand
Joined: Sep 30, 2008
Posts: 198
|
|
|
That means class path is not set properly. BTW when you face this error compile time or run time?
|
My Blog
|
 |
Nishan Patel
Ranch Hand
Joined: Sep 07, 2008
Posts: 676
|
|
Hi,
That will not happen Put your mySql connection jar to your lib folder of web inf will automatically add to your build path.
Or if it will not add just right click on jar and select add to build path.
|
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
|
 |
Vijitha Kumara
Bartender
Joined: Mar 24, 2008
Posts: 3673
|
|
aruna sameera wrote: but if i set the buildPath to the mysql connector using configureBuildPath it says class NotFound error?
Which context are you setting these? In IDE?
|
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 689
|
|
no i mean if i put jar file to the lib folder it is working.
but if not doing that if i set the build path to the mysql.jar it gives class Not Found error
|
 |
VIJAY Yadlapati
Ranch Hand
Joined: Aug 04, 2003
Posts: 175
|
|
|
Try setting the classpath, not in build path
|
 |
VIJAY Yadlapati
Ranch Hand
Joined: Aug 04, 2003
Posts: 175
|
|
|
Try setting the classpath
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 689
|
|
|
I am using eclips IDE .How to set classpath using eclips.
|
 |
Albareto McKenzie
Ranch Hand
Joined: Apr 08, 2009
Posts: 268
|
|
Hi there!
In Eclipse: Window > Preferences > Java > Build Path > Classpath Variables > New (or edit if you have one)
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 689
|
|
this is my servlet
this is the error i got.
i set the class path to the mysql-connector.jar file using window-preference.......
but still error remain
|
 |
Albareto McKenzie
Ranch Hand
Joined: Apr 08, 2009
Posts: 268
|
|
|
But does your classes see that class? If you import com.mysql.jdbc.Driver an error is displayed or something like that?
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 689
|
|
Yes.i put the
import com.mysql.jdbc.Driver;
but error is still remain.
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 689
|
|
this is happening for only web application
i used this methed(getcon()) in a java application.it is working.
|
 |
Albareto McKenzie
Ranch Hand
Joined: Apr 08, 2009
Posts: 268
|
|
|
Ok, that seems to be that you don't have that librarie included in your project, you have to add it and the problem is gone.
|
 |
 |
|
|
subject: mysql connector Class NotFound error
|
|
|