Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / July 2003

Tip: Looking for answers? Try searching our database.

main

Thread view: 
Jos Walrave - 14 Jul 2003 22:03 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."

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?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.