Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

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

504701Apr 6 2006 — edited Feb 25 2011
I must apoligise for this age old query in advance.
If this post in not in the right place, again i must apoligise.

Been using java for a while now expecially with netbeans. Recently started executing the jar files created by netbeans.

My jar file holds quite a simple application-> to execute an insert on a particular table within my oracle db. [This application Runs perfectly through NetBeans].
I want to run this jar file from the command prompt using the java -jar [option].

When i run the jar from the prompt i get this whole spiel(Story) from java:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
C:\Documents and Settings\Owner\My Documents\Reciepts\BookClub\dist>java -jar Bo
okClub.jar
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at bookclub.toDbms.<init>(toDbms.java:29)
at bookclub.Main.main(Main.java:32)
Press ANY key to execute

INSERT INTO Members(member_id, group_id, first_name, last_name, address, town, city, phone_code, phone_num) VALUES(16,30,'Maybe',Someone','Mount Street','Somewhere','Dublin','01','1234567')
java.lang.NullPointerException
at bookclub.toDbms.execute(toDbms.java:48)
at bookclub.Main.main(Main.java:46)
Press any key continue the application

I gather the null pointer exception is comming from the missing drivers!

My Details:

C:\Documents and Settings\Owner>echo %classpath%
c:\oracle\ora92\jdbc\lib\ojdbc14.jar

C:\Documents and Settings\Owner>java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

(all oracle driver classs .jar files are here)
Path=c:\j2sdk1.4.2_04\bin;c:\oracle\ora92\jdbc\lib;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;......

If anyone out there can point me in some sort of a direction with this one, be most gratefull.

DobSun [or [i]user501698]

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 25 2011
Added on Apr 6 2006
16 comments
32,424 views