oracle.jdbc.driver.OracleDriver ClassNotFoundException
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
Just add the ojdbc14.jar to your classpath.
The following are the steps that are given below to add ojdbc14.jar in eclipse:
1) Inside your project
2) Libraries
3) Right click on JRE System Library
4) Build Path
5) Select Configure Build Path
6) Click on Add external JARs...
7) C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib
8) Here you will get ojdbc14.jar
9) select here
10) open
11) ok
save and run the program you will get output.
Class.forName("oracle.jdbc.driver.OracleDriver");
This line causes ClassNotFoundException
, because you haven't placed ojdbc14.jar
file in your lib folder of the project. or YOu haven't set the classpath
of the required jar
Method 1: Download ojdbc.jar
add ojdbc6.jar to deployment assembly. Right click on project->properties->select deployment assembly->click on 'Add' ->select 'Archives from File System'->browse to the folder where ojdbc6.jar is saved.->add the jar->click finish->Apply/OK.
Method 2:
if you want to add ojdbc.jar to your maven dependencies you follow this link: http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/ . . Even if you're using a maven project it is not necessary to add ojdbc to maven dependencies(method 2), method 1 (adding directly to deployment assembly) works just fine.
In Eclipse , rightclick on your application
Run As -> Run configurations -> select your server from type filter text box
Then in Classpath under Bootstrap Entries add your classes12.jar File and Click on Apply.
Now, run the file...... This worked for me !!