我想通过Java在网页上使用Sqlite。 我收到以下错误:Java服务器中的Sqlite JDBC页面
java.lang.NoClassDefFoundError: org/sqlite/JDBC
model.DataBase.<init>(DataBase.java:35)
我已经尝试了两种选择:
this.conn = new org.sqlite.JDBC().connect("jdbc:sqlite:" + file, new Properties());
this.stm = this.conn.createStatement();
和
Class.forName("org.sqlite.JDBC");
this.conn = DriverManager.getConnection("jdbc:sqlite:" + file);
this.stm = this.conn.createStatement();
我使用Eclipse和我配置的jar文件在构建路径中,当作为桌面应用程序运行时,它也能正常工作。
无需摆弄构建路径/导出属性。只需将JAR放入'/ WEB-INF/lib'文件夹就足够了。 – BalusC