【问题标题】:Derby+apache can't find main德比+阿帕奇找不到主
【发布时间】:2014-02-05 06:32:04
【问题描述】:

我已经根据this guide 下载了 db-derby-10.10.1.1-bin 安装它现在当我尝试运行下面的代码时,它说: 线程“主”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:";
}

我的主要课程在我的工作区目录中。有什么问题?

【问题讨论】:

    标签: java eclipse derby


    【解决方案1】:

    derby.jar 和 derbytools.jar 必须存在于 CLASSPATH 中才能使用 apache 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:虽然它不起作用
    猜你喜欢
    • 1970-01-01
    • 2011-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-05
    • 2014-03-15
    • 2013-04-24
    相关资源
    最近更新 更多