我的程序是这个
import java.sql.*;
import java.io.*;
import java.util.*;
class TestMysql{
public static void main(String[] age){
try{
Connection conn =getConnection();
Statement stat =conn.createStatement();
stat.execute("CREATE TABLE Greetings (Name CHAR(20))");
stat.execute(
"INSERT INTO Greetings Values ('hello, world!')");
ResultSet result
=stat.executeQuery ("SELECT * FROM Greetings");
stat.close();
conn.close();
}
catch (SQLException ex)
{
while(ex != null){
ex.printStackTrace();
ex =ex.getNextException();
}}
catch(IOException ex){
ex.printStackTrace();
}}
public static Connection getConnection()
throws SQLException, IOException
{
Properties props =new Properties();
FileInputStream in=
new FileInputStream("database.properties");
props.load(in);
in.close();
String drivers =props.getProperty("com.mysql.jdbc.Driver");
if(drivers != null)
System.setProperty("jdbc.drivers",drivers);
String url = props.getProperty("jdbc:mysql://host:3306/wlove");
String username = props.getProperty("root");
String password = props.getProperty("1985122546");
return
DriverManager.getConnection(url,username, password);
}}
我在家编译通过测试了 , 也生成了CLASS文件, 可是,不出HELLO,WORD!
我去DOC下自己编译了一下
告诉这个错误
exception in thread "main" java.lang.noclassdefounderror:Test 我看不懂谁能给我解释一下这个啊