Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class not found exception

 
jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all;
Well i am getting exception when loading driver.
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
The program is
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.OracleDriver;
public class A
{
public static void main(String args[]){
Connection con=null;
Statement stmt=null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
//con=DriverManager.getConnection("jdbc racle:thin:@JAWWAD:1521 EMREP","scott","tiger");
}catch(ClassNotFoundException e){
System.out.println(e);
}
//catch(SQLException e){
//System.out.println("The Sql En caught is");
//}
System.out.println("Success");
}
}
I have putten the class12.jar in g:\jdk1.3\jre\lib\ext\classes12.jar
Also have putten the oracle.jdbc.driver.OracleDriver in the A.java path but no way found.
Can any body tell where i am wong please.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When using the "jre/lib/ext" method you need to be careful that you are putting your jars in the right place. On Windows systems, for example, there is often another "JRE" in Program Files, which may be used in preference to the one where you have put your jar file.
If you are running on a Windows system, please do a "find" on all your local disks to see if you have more than one such dirtectory. Of you have, try placing your Oracle jar in there as well.
Also, your "import" statement for the Oracle driver is not necessary, and may actually be wrong. When you create a class from it's name, you should not "import" it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic