作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试根据 this guide 在 eclipse 上安装 derby
我的$CLASSPATH:
/opt/Apache/db-derby-10.10.1.1-bin/lib/derby.jar:/opt/Apache/db-derby-10.10.1.1-bin/lib/derbytools.jar
我还通过项目属性将其添加到 Java 构建路径中。现在每当我运行我的程序时,它都会说:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/derby/impl/tools/sysinfo/Main
Caused by: java.lang.ClassNotFoundException: org.apache.derby.impl.tools.sysinfo.Main
有什么解决办法吗?我的代码:导入java.sql.Connection;导入 java.sql.DriverManager;导入 java.sql.PreparedStatement;导入java.sql.ResultSet;导入java.sql.SQLException;导入java.sql.Statement;
导入java.util.ArrayList;导入java.util.Properties;
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:";
}
最佳答案
右键单击您的项目运行方式 > 运行对话框 > 类路径选项卡,然后通过单击添加外部 jar 添加 derby.jar 、 derbynet.jar 和 derbyclient.jar
这三个jar文件可以在从apatche DB下载的文件夹中找到它们
关于java - Derby 和 eclipse 。 "Can' t find main"异常。如何将Derby添加到配置类路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21645978/
我是一名优秀的程序员,十分优秀!