I am trying to use Sqlite on a web page over Java.
I am getting the following error:
java.lang.NoClassDefFoundError: org/sqlite/JDBC
model.DataBase.<init>(DataBase.java:35)
I’ve tried the two alternatives:
this.conn = new org.sqlite.JDBC().connect("jdbc:sqlite:" + file, new Properties());
this.stm = this.conn.createStatement();
and
Class.forName("org.sqlite.JDBC");
this.conn = DriverManager.getConnection("jdbc:sqlite:" + file);
this.stm = this.conn.createStatement();
I am using Eclipse and I’ve configured the jar file in the build path, also, when running as a desktop application it works fine.
Just having the sqllite.jar in your build path is not enough. If you are running it as a web application place the jar in the /WEB-INF/lib folder as well.
You can tell eclipse to export that file as well.