I am a newbie. I just created this java code, for which JBuilder 8
Enterprise generates when build the following message : " Could not find the
main class. Will exit program."
Can someone advise me on this and also on the runtime configuration settings
? I understand one can define a default setting regarding the purpose of
your code (application, etc.).
Here is my code so far:
------------------------------------------------- >
import java.sql.*;
class loadJdbc {
public static void main (String[] args) {
try {
// try/catch clause to handle exception conditions
Connection connection = null;
String driverName = "com.ddtek.jdbcx.sqlserver.SQLServerDriver"; //
DataDirect JDBC Driver
String serverName = "127.0.0.1";
String portNumber = "1433";
String mydb = "DatabaseName=BugTracking";
String mydatabase = serverName + ":" + portNumber + ";" + mydb;
String url = "jdbc:datadirect:sqlserver://" + mydatabase; // DataDirect
JDBC URL (see page 19 jdbcref)
String username = "";
String password = "";
// Load the JDBC driver
Class.forName(driverName);
// Create connection to db
connection = DriverManager.getConnection(url,username,password);
// Create a result set containing all data from tblPermissions
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM tblPermissions");
// Fetch each row from the result set
while (rs.next()) {
// Get the data from the row using the column index
String s = rs.getString(1);
s = rs.getString("userID");
System.out.println(s);
}
}
catch (ClassNotFoundException e) {
// Couldn't find the db driver
}
catch (SQLException e) {
// Couldn't connect to the db
}
}
}
Thanks in advance
Tor Iver Wilhelmsen - 17 Jul 2003 18:34 GMT
> I am a newbie. I just created this java code, for which JBuilder 8
> Enterprise generates when build the following message : " Could not find the
> main class. Will exit program."
Are you sure youy have set up a runtime configuration which uses that
class as an application main? And are you sure you have successfully
compiled the class first?