gpt4 book ai didi

java - Derby+apache 找不到 main

转载 作者:太空宇宙 更新时间:2023-11-04 07:04:54 26 4
gpt4 key购买 nike

我已经下载了db-derby-10.10.1.1-bin并按照this guide安装了它现在,当我尝试运行下面的代码时,它说:线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/derby/impl/tools/sysinfo/Main(我已将其安装到 orp/Apache/derby 中)

public class Sample2 {

public static void main(String[] args) {
System.out.println("POOP");
new Sample2().go(args);
System.out.println("SimpleApp finished");


}
void go(String[] args){
Connection conn = null;
ArrayList statements = new ArrayList();
PreparedStatement psInsert = null;
PreparedStatement psUpdate = null;
Statement s = null;
ResultSet rs = null;
String dbName = "Lab4DB";
try {
conn = DriverManager.getConnection(protocol + dbName);
System.out.println("Connected to and created database " + dbName);
conn.setAutoCommit(false);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
private String framework = "embedded";
private String driver = "org.apache.derby.jdbc.EmbeddedDriver";
private String protocol = "jdbc:derby:";
}

我的主类位于我的工作区目录中。有什么问题吗?

最佳答案

derby.jar 和 derbytools.jar 必须存在于 CLASSPATH 中才能使用 apache derby。

关于java - Derby+apache 找不到 main,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21570184/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com