473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

class not found exception

hi,
i got class not found exception of a small jdbc program in windows.

the program is like this
Expand|Select|Wrap|Line Numbers
  1. import java.sql.*;
  2. public class Db1
  3. {         
  4.         public static void main(String a[]) throws Exception
  5.         {
  6.        Class.forName("oracle.jdbc.driver.OracleDriver");
  7.     //Driver  drv=new oracle.jdbc.driver.OracleDriver();
  8.     //DriverManager.registerDriver(drv);
  9.         Connection con=DriverManager.getConnection("jdbc.oracle:thin:@localhost:1521:orcl","scott","tiger");
  10.         System.out.println("concls->"+con.getClass());
  11.  
  12.         }
  13. }
  14.  and the problem is like this
  15.  
  16.  
  17. E:\work>javac Db1.java
  18. Db1.java:21: cannot find symbol
  19. symbol  : variable con
  20. location: class Db1
  21.              System.out.println("concls->"+con.getClass());
  22.                                            ^
1 error

E:\work>javac Db1.java

E:\work>java Db1
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
Exception in thread "main" java.lang.NullPointerException
at Db1.main(Db1.java:21)

E:\work>javac Db1.java

E:\work>java Db1
Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.
OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Db1.main(Db1.java:6)

E:\work>

I already set the classpath and i already check the Services.msc also.
there is no problem over their.

i am using oracle 9 software
Dec 17 '07 #1
4 2112
debasisdas
8,127 Expert 4TB
Question moved to java forum .
Dec 17 '07 #2
BigDaddyLH
1,216 Expert 1GB
I already set the classpath
But what did you set it to? Does it include the driver's jar? I don't think so!
Dec 17 '07 #3
But what did you set it to? Does it include the driver's jar? I don't think so!

the necessary jar file for my jdbc driver is classes12.jar
i copied tht into my working directory.. like this

E:\work\classes12.jar
Dec 18 '07 #4
BigDaddyLH
1,216 Expert 1GB
the necessary jar file for my jdbc driver is classes12.jar
i copied tht into my working directory.. like this

E:\work\classes12.jar
It doesn't matter where you put library jars, like your driver jar, as long as the jar is on the classpath!
Dec 18 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: dinks | last post by:
Hi, I'm new to C++ and have been assigned a task which i dont completely understand. Any help would be greately appreciated. Here is the problem: The class "linkedListType" use the "assert"...
4
by: Rahul Anand | last post by:
Getting SQL Exception when trying to implement Connection based Trasaction using SQL Helper class. I am using the follwing function to execute my stored procs: -=-=-=- ExecuteScalar(ByVal...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
0
by: Daniel Sélen Secches | last post by:
I found a good class to do a simple FTP. Very good.... I'm posting it with the message, i hope it helps someone ============================================================== Imports...
1
by: Jim | last post by:
Have fully operational software package developed on VB.NET that worked until Jan 1 2003, with early stage deployments on Oct 10, Oct 23, Nov 11, Dec 12 and Dec 30. When attempted final...
0
by: Nol | last post by:
Hi all, My webservice throws an exception, which is translated into a soap Fault in the soap message body. See below for the actual message format as it is send by the server. On the (dotNet)...
12
by: mast2as | last post by:
Hi everyone... I have a TExceptionHandler class that is uses in the code to thow exceptions. Whenever an exception is thrown the TExceptionHander constructor takes an error code (int) as an...
0
by: dfa_geko | last post by:
Hi All, Just had a question about the RSACryptoServiceProvider class. I'm kind of a newbie at this. In the following code at the end of the message, does the key get stored in the User...
11
by: Rafe | last post by:
Hi, I'm working within an application (making a lot of wrappers), but the application is not case sensitive. For example, Typing obj.name, obj.Name, or even object.naMe is all fine (as far as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.