Home » Developer & Programmer » JDeveloper, Java & XML » ClassNotFound exception (split topic)
ClassNotFound exception (split topic) [message #285650] Wed, 05 December 2007 04:07 Go to next message
sanjava
Messages: 3
Registered: December 2007
Junior Member
import java.sql.*;
import java.io.*;
import java.util.*;
import java.math.*;

class Employee
{
public static void main (String args [])
throws Exception
{






try {
// Register the Oracle JDBC driver
System.out.println("Registring the driver...");
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());


// You can put a database name after the @ sign in the connection URL.
Connection conn = DriverManager.getConnection
("jdbc:oracle:oci:@//localhost","TESTDB","TESTDBA");

// Create a Statement
Statement stmt = conn.createStatement ();

// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");

// Iterate through the result and print the employee names
while (rset.next ())
System.out.println (rset.getString (1));

conn.close();

} catch (Exception e) { e.printStackTrace(); }


i have cmpile this code
I amgetting error
class notfound exception in thread "main"
Re: ClassNotFound exception (split topic) [message #285663 is a reply to message #285650] Wed, 05 December 2007 04:28 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Hi and welcome to the forum.
If you have a question, it is ok to post it as a reply to an existing thread, but only if it is (closely) related to the subject in that thread. You posted this as a reply to something totally unrelated.

Now for your question: Please post the stacktrace, as that gives an indication of what class cannot be found.

Please also copy-paste your commandline to show how you tried to call the class
Re: ClassNotFound exception (split topic) [message #285921 is a reply to message #285663] Thu, 06 December 2007 01:49 Go to previous messageGo to next message
sanjava
Messages: 3
Registered: December 2007
Junior Member
import java.sql.*;
import java.io.*;
import java.util.*;
import java.math.*;

class Employee
{
public static void main (String args [])
throws Exception
{






try {
// Register the Oracle JDBC driver
System.out.println("Registring the driver...");
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());


// You can put a database name after the @ sign in the connection URL.
Connection conn = DriverManager.getConnection
("jdbc:oracle:oci:@//localhost","TESTDB","TESTDBA");

// Create a Statement
Statement stmt = conn.createStatement ();

// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");

// Iterate through the result and print the employee names
while (rset.next ())
System.out.println (rset.getString (1));

conn.close();

} catch (Exception e) { e.printStackTrace(); }


i have cmpile this code
I amgetting error
class notfound exception in thread "main"
  • Attachment: cmd.doc
    (Size: 314.92KB, Downloaded 2655 times)
Re: ClassNotFound exception (split topic) [message #285922 is a reply to message #285663] Thu, 06 December 2007 01:50 Go to previous messageGo to next message
sanjava
Messages: 3
Registered: December 2007
Junior Member
import java.sql.*;
import java.io.*;
import java.util.*;
import java.math.*;

class Employee
{
public static void main (String args [])
throws Exception
{






try {
// Register the Oracle JDBC driver
System.out.println("Registring the driver...");
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());


// You can put a database name after the @ sign in the connection URL.
Connection conn = DriverManager.getConnection
("jdbc:oracle:oci:@//localhost","TESTDB","TESTDBA");

// Create a Statement
Statement stmt = conn.createStatement ();

// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");

// Iterate through the result and print the employee names
while (rset.next ())
System.out.println (rset.getString (1));

conn.close();

} catch (Exception e) { e.printStackTrace(); }


i have cmpile this code
I amgetting error
class notfound exception in thread "main
  • Attachment: cmd.doc
    (Size: 378.50KB, Downloaded 2060 times)
Re: ClassNotFound exception (split topic) [message #285924 is a reply to message #285922] Thu, 06 December 2007 02:01 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Why repost the code?
I asked for a copy-paste of the execution plus stack-trace. The code was posted in the original question.
Maybe you posted what I asked for in your .doc, but I don't download .doc attachments.
Just copy the lines from your terminal session (terminal or dos-box, whatever) and paste them here within code-tags.
Re: ClassNotFound exception (split topic) [message #287173 is a reply to message #285922] Tue, 11 December 2007 05:31 Go to previous message
mr.rajeshyadav
Messages: 48
Registered: November 2007
Member
I think that is not bcause of oracle first let me know you have compiled Employee2.java and then you are trying to execute Employee class.

First of all declare that class as public and save that one with Employee.java and then try to compile and execute.
Previous Topic: how can i use been area in semple way
Next Topic: java.sql.SQLException: Io exception: Undefined Error
Goto Forum:
  


Current Time: Fri Mar 29 04:41:03 CDT 2024