Subject | Error runing java program |
---|---|
Author | Bayu |
Post date | 2003-02-22T01:10:35Z |
Hi all
I have a sample code in java like this ( taken from developer.java.sun.com
and modified small )
import java.sql.*; //import all the JDBC classes
public class CreateJoltDataFB {
static String[] SQL = {
"create table JoltData ("+
"programmer varchar (32),"+
"day varchar (3),"+
"cups integer);",
"insert into JoltData values ('Gilbert', 'Mon', 1);",
"insert into JoltData values ('Wally', 'Mon', 2);",
"insert into JoltData values ('Edgar', 'Tue', 8);",
"insert into JoltData values ('Wally', 'Tue', 2);",
"insert into JoltData values ('Eugene', 'Tue', 3);",
"insert into JoltData values ('Josephine', 'Wed', 2);",
"insert into JoltData values ('Eugene', 'Thu', 3);",
"insert into JoltData values ('Gilbert', 'Thu', 1);",
"insert into JoltData values ('Clarence', 'Fri', 9);",
"insert into JoltData values ('Edgar', 'Fri', 3);",
"insert into JoltData values ('Josephine', 'Fri', 4);",
};
public static void main(String[] args) {
String URL =
"jdbc:firebirdsql.localhost:e:\\projects\\java\\jdbc\\cofeebreak.gdb";
String username = "sysdba";
String password = "masterke";
try {
Class.forName("org.firebirdsql.jdbc.FBDriver");
} catch (Exception e) {
System.out.println("Failed to load JDBC/ODBC driver.");
return;
}
Statement stmt = null;
Connection con=null;
try {
con = DriverManager.getConnection (
URL,
username,
password);
stmt = con.createStatement();
} catch (Exception e) {
System.err.println("problems connecting to "+URL);
}
try {
// execute SQL commands to create table, insert data
for (int i=0; i<SQL.length; i++) {
stmt.execute(SQL[i]);
}
stmt.close();
con.close();
} catch (Exception e) {
System.err.println("problems with SQL sent to "+URL+
": "+e.getMessage());
}
}
}
I execute with sintax java -classpath %classpath% CreateJoltDataFB then
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/resource/Resour
ceException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at CreateJoltDataFB.main(CreateJoltDataFB.java:29)
I trace in rt.jar on my j2sdk1.4.1_01 distro the
javax/resource/ResourceException doesn't exist.
There is miss files or i have no classpath enough ?
Thanks for your reply...
rgrds
Bayu
I have a sample code in java like this ( taken from developer.java.sun.com
and modified small )
import java.sql.*; //import all the JDBC classes
public class CreateJoltDataFB {
static String[] SQL = {
"create table JoltData ("+
"programmer varchar (32),"+
"day varchar (3),"+
"cups integer);",
"insert into JoltData values ('Gilbert', 'Mon', 1);",
"insert into JoltData values ('Wally', 'Mon', 2);",
"insert into JoltData values ('Edgar', 'Tue', 8);",
"insert into JoltData values ('Wally', 'Tue', 2);",
"insert into JoltData values ('Eugene', 'Tue', 3);",
"insert into JoltData values ('Josephine', 'Wed', 2);",
"insert into JoltData values ('Eugene', 'Thu', 3);",
"insert into JoltData values ('Gilbert', 'Thu', 1);",
"insert into JoltData values ('Clarence', 'Fri', 9);",
"insert into JoltData values ('Edgar', 'Fri', 3);",
"insert into JoltData values ('Josephine', 'Fri', 4);",
};
public static void main(String[] args) {
String URL =
"jdbc:firebirdsql.localhost:e:\\projects\\java\\jdbc\\cofeebreak.gdb";
String username = "sysdba";
String password = "masterke";
try {
Class.forName("org.firebirdsql.jdbc.FBDriver");
} catch (Exception e) {
System.out.println("Failed to load JDBC/ODBC driver.");
return;
}
Statement stmt = null;
Connection con=null;
try {
con = DriverManager.getConnection (
URL,
username,
password);
stmt = con.createStatement();
} catch (Exception e) {
System.err.println("problems connecting to "+URL);
}
try {
// execute SQL commands to create table, insert data
for (int i=0; i<SQL.length; i++) {
stmt.execute(SQL[i]);
}
stmt.close();
con.close();
} catch (Exception e) {
System.err.println("problems with SQL sent to "+URL+
": "+e.getMessage());
}
}
}
I execute with sintax java -classpath %classpath% CreateJoltDataFB then
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/resource/Resour
ceException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at CreateJoltDataFB.main(CreateJoltDataFB.java:29)
I trace in rt.jar on my j2sdk1.4.1_01 distro the
javax/resource/ResourceException doesn't exist.
There is miss files or i have no classpath enough ?
Thanks for your reply...
rgrds
Bayu