Home » Developer & Programmer » JDeveloper, Java & XML » Could not find the main class. Program will exit.
Could not find the main class. Program will exit. [message #214691] Wed, 17 January 2007 10:39
harleenflora
Messages: 44
Registered: June 2006
Member
Why am i getting following error message when I try to run Java Class in JDeveloper:
"Could not find the main class. Program will exit."


Follwing is my code, I just want to connect to Oracle database and displaying the result of Select Statement:

package my_project;

// Importing packages
import java.sql.*;

public class my_class1 {
public my_class1() {
}
public static void main (String args []) {
try{
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (Exception e) {
System.out.println("Failed to load Oracle/JDBC driver.");
return;
}
// Load Oracle driver
// DriverManager.registerDriver ((Driver)new oracle.jdbc.OracleDriver());

// Connect to the local database
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@oradev.cns.gov:1526:DEV9", "username", "password6");

// Query the employee names
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("select * from agmt_psp");

// Print the name out
while (rset.next ())
System.out.println (rset.getString (1));

// close the result set, statement, and the connection
rset.close();
stmt.close();
conn.close();
}
catch(Exception e){
System.out.println("Got an exception");
System.out.println(e.getMessage());
}
}
}



Previous Topic: How to open excel
Next Topic: jsp give me this error javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver
Goto Forum:
  


Current Time: Thu Mar 28 10:24:16 CDT 2024