(SOLVED) java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

I wrote a Java Servlet program but when I run it, it was showing the Exception

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

When I give the

 java oracle.jdbc.driver.OracleDriver 

command in command prompt, it was showing following lines

Error: Main method not found in class oracle.jdbc.driver.OracleDriver, please define the main method as:
       public static void main(String[] args)

Solution :

ave you copied classes12.jar in lib folder of your web application and set the classpath in eclipse.

Right-click project in Package explorer Build path -> Add external archives…

Select your ojdbc6.jar archive

Press OK


Go through this link and read and do carefully.

The library should be now referenced in the “Referenced Librairies” under the Package explorer. Now try to run your program again.

Marwen Mselmi
Author: Marwen Mselmi

Founder of Javatuto.com, love Java and open source stuff. Follow me on Linkedin.

Leave a comment