java.lang.ClassNotFound Exception error

What would cause the classNotFound Exception error? Using Orcale7.3, JDK1.2.3 and oracle7 JDBC driver. Followed all the instructions for installations and set my classpath.
When I run the JdbcCheckup example provided I get this error:

java.lang.ClassNotFound Exception : oracle/jdbc/driver/OracleDriver
at java.lang.Class.forName(Native Method)

But it compiles without problem.

Many thanks for your help.

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

vertidigerConnect With a Mentor Commented:
Jake -

  evijay's answer was correct, you must add the file to your class path.
Your program will compile because it will not attempt to create an instance of the
oracle.jdbc.driver.OracleDriver until run time.  

   Here's some details straight from my working set up:
Java Code:
    catch(ClassNotFoundException  ex)
      System.out.println("Sorry Jake, is still not found in classpath.");
   On Windows:
      from dos:
           C:\>set ClassPath=%ClassPath%;C:\jdbc\lib\
           C:\>echo %ClassPath%
      or in autoexec.bat file:
           set ClassPath=%ClassPath%;C:\jdbc\lib\
    On Unix(Linux):
        in .bashrc (or whatever shell you're using)
           export CLASSPATH=$CLASSPATH:/home/jake/jdbc/lib/
        from commandline:
            #->export CLASSPATH=$CLASSPATH:/home/jake/jdbc/lib/
            #->echo $CLASSPATH

In both cases echo is not necessary, and just prints out the classpath so that you
can verify that the path to the zip file was added correctly. You'll want to change the
directory in the commands to match where it is on your disk. You may want to move
the file into the lib directory in your jdk folder. That will make it easier
to find and make your classpath easier to maintain.

oracle.jdbc.driver.OracleDriver is located inside the zip file.  If you look at the
reference material on java packages you will find the details.  If you were to
unzip the file you would find that inside a folder called oracle
there was a folder called jdbc and inside that folder there was another folder
called driver and finally, inside the driver folder there was a class file called
OracleDriver.class.  Java knows how to find the class inside the zip file,
you just need to tell java where the class file is.  You do not want leave
the unziped file on your system if you unzip it.  That can
cause problems for java when it attempts to find the class.
the problem is not the javacode, as you wrote your classpath
seems to be OK in this situation, but your PATH not,
or at least your ORACLE JDBC-support DLL is not found.

'native Method' means that the function is implemented
in another language, and that it will be imported at runtime from a provided DLL.

But I cant tell which DLL is not found and I dont know where it should be placed

I hope this helps !

Please include
oraclejdbc\thin\lib\ in your CLASSPATH.

set CLASSPATH=%CLASSPATH%;c:\oraclejdbc\thin\lib\


The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

missing class is quite sure a Java class - and that is the class that implements the real Oracle JDBC driver. it's name is

it compiles without problems, because you your compiler does not uses this class - it is loaded at run time from this line
jmoniAuthor Commented:

Thanks for your effort but the zip files are in c:\jdbc There is no directory with this path c:\orcalejdbc\thin\lib\

I thought this was suppose to be straight forward. Where is this class "oracle.jdbc.driver.OracleDriver" located?


There will be somewhere in c:\jdbc directory, some zip files. Include the full path names of each of the zip files in the classpath. I just gave an example in my answer.

All Courses

From novice to tech pro — start learning today.