德比和月食。 "找不到主"例外。如何德比添加到类路径的配置? [英] Derby and eclipse. "Can't find main" exception. How to add Derby to configuration classpath?
问题描述
我试图按照本指南对日食安装德比
我的$ CLASSPATH:
<$p$p><$c$c>/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构建路径。现在,每当我运行我的程序,它说:
异常线程mainjava.lang.NoClassDefFoundError的:组织/阿帕奇/德比/ IMPL /工具/ SYSINFO /主
抛出java.lang.ClassNotFoundException:引起org.apache.derby.impl.tools.sysinfo.Main
任何解决方案?
我的code:
进口java.sql.Connection中;
进口java.sql.DriverManager中;
。进口的java.sql preparedStatement;
进口java.sql.ResultSet中;
进口值java.sql.SQLException;
进口java.sql.Statement中;
导入java.util.ArrayList的;
进口java.util.Properties;
公共类样品2 { 公共静态无效的主要(字串[] args){
的System.out.println(POOP);
新的样品2()去(参数);
的System.out.println(SimpleApp完成);
}
无效围棋(字串[] args){
康涅狄格州的连接= NULL;
ArrayList的语句=新的ArrayList();
preparedStatement psInsert = NULL;
preparedStatement psUpdate = NULL;
声明S = NULL;
ResultSet的RS = NULL;
字符串DBNAME =Lab4DB;
尝试{
康恩=的DriverManager.getConnection(协议+数据库名);
的System.out.println(连接到和创建的数据库+ DBNAME);
conn.setAutoCommit(假);
}赶上(的SQLException E){
// TODO自动生成catch块
e.printStackTrace();
} }
私人字符串框架=嵌入;
私人串驱动器=org.apache.derby.jdbc.EmbeddedDriver;
私人字符串协议=的jdbc:德比:
}
右键点击您的项目运行方式>运行对话框>则类路径选项卡中点击添加外部jar添加的derby.jar,derbynet.jar和derbyclient.jar中
这三个jar文件你可以从apatche DB下载的文件夹中找到它们
I'm trying to install derby on eclipse according to this guide
My $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
I've also added it to Java build path via project properties. Now whenever i run my program, it says:
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
Any solutions? My code: import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;
import java.util.ArrayList; import 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:";
}
right click on your project run as > run dialog > class path tab then add derby.jar , derbynet.jar and derbyclient.jar by clicking on add external jar
those three jar file you can find them in the folder downloaded from apatche DB
这篇关于德比和月食。 &QUOT;找不到主&QUOT;例外。如何德比添加到类路径的配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!