java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver Exception comes when you lot sweat to connect Oracle database from Java plan together with Oracle driver is non available inwards Classpath. We bring already seen How to connect Oracle database from Java program together with institute that, In gild to connect to Oracle database, nosotros charge together with register driver using Class.forName("oracle.jdbc.driver.OracleDriver") together with this code loads a class at runtime using Reflection which throws ClassNotFoundException if the shape inwards enquiry e.g. "oracle.jdbc.driver.OracleDriver" is non found. I bring already listed downwardly various reason of ClassNotFoundExcepiton inwards Java, which is too applicable inwards this case. By the agency java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver is similar to java.lang.ClassNotFoundException: MySQL.jdbc.driver.MySQLDriver which comes if you lot sweat to connect MySQL database from Java plan together with corresponding driver is non inwards your classpath. You tin refer link for getting to a greater extent than ideas which tin live on used to laid java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver mistake equally well.
How to solve java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
In gild to solve java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver, nosotros take away these shape either inwards the shape of JAR or classes inwards your application classpath. For Oracle 10g together with 11g, these are introduce inwards ojdbc6.jar or ojdbc6_g.jar, which are same except later on is compiled alongside javac -g pick to include debug information together with tracing code. If you lot don't bring this JAR together with thence you lot tin download it from http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html.
Just download this JAR file together with add together into your Classpath past times next steps given in How to laid Classpath inwards Java. If you are non real comfortable alongside setting classpath together with thence you lot tin too pose this JAR file inwards JRE/ext directory C:\Program Files\Java\jdk1.6.0_20\jre\lib\ext which is used past times extension shape loader to charge shape file, though it's non advisable together with you lot should alone produce this for testing equally chances of leaving that ojdbc6.jar are to a greater extent than which may crusade inwards hereafter if you lot bring a novel version of driver somewhere else inwards Application classpath but your Java application all the same picking these quondam drivers. See How classloader industrial plant inwards Java for to a greater extent than details on this issue.
Just download this JAR file together with add together into your Classpath past times next steps given in How to laid Classpath inwards Java. If you are non real comfortable alongside setting classpath together with thence you lot tin too pose this JAR file inwards JRE/ext directory C:\Program Files\Java\jdk1.6.0_20\jre\lib\ext which is used past times extension shape loader to charge shape file, though it's non advisable together with you lot should alone produce this for testing equally chances of leaving that ojdbc6.jar are to a greater extent than which may crusade inwards hereafter if you lot bring a novel version of driver somewhere else inwards Application classpath but your Java application all the same picking these quondam drivers. See How classloader industrial plant inwards Java for to a greater extent than details on this issue.
That's all on How to laid java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver inwards Java. This is similar whatever other touchstone java.lang.ClassNotFoundException except that you lot should know on which JAR file you lot tin uncovering this driver i.e. ojdbc6.jar. If you lot are using Eclipse together with thence you lot tin simply include this JAR inwards your create path past times selecting a project, correct click, properties, Java Build path together with and thence adding JAR on libraries tab. You tin fifty-fifty verify whether oracle.jdbc.driver.OracleDriver is inwards your Classpath or not past times using Eclipse shortcut for checking classes inwards projection classpath.
Further Learning
Complete Java Masterclass
How to remote debug Java application inwards Eclipse