SQLite Java Wrapper/JDBC Driver
I'm trying to install the SQLite Java Wrapper/JDBC Driver from http://www.ch-werner.de/javasqlite/ .
The install seems to have gone ok. But when I try to
make test
java test
I get the error
Unable to load sqlite: java.lang.UnsatisfiedLinkError: no sqlite_jni in java.library.path
Exception in thread "main" java.lang.UnsatisfiedLinkError: version
at SQLite.Database.version(Native Method)
at test.main(test.java:72)
Anyone know how to fix?
Thanks
[517 byte] By [
qt4x11a] at [2007-11-27 6:22:43]

From http://www.ch-werner.de/javasqlite/index.html):
To override the directory where configure looks for SQLite and JDK the configure options --with-sqlite=DIR, --with-sqlite3=DIR, and --with-jdk=DIR can be used. To specify the place where the native library (the libsqlite_jni.so file) shall be installed, use the --prefix=DIR option. The default place is /usr/local/lib, i.e. the prefix defaults to /usr/local. To specify where the sqlite.jar file containing the high-level part and the JDBC driver shall be installed, use the --with-jardir=DIR option. The default is /usr/local/share/java. At runtime, it is necessary to tell the JVM both places with the -classpath and -Djava.library.path=.. command line options.
Does this look right?
I was able to make test, but when i try to run the classfile I get this error
# java -classpath /usr/local/lib -Djava.library.path=/usr/local/lib test
Exception in thread "main" java.lang.NoClassDefFoundError: test
(I can see that the installer script has installed libsqlite_jni.so in /usr/local/lib)
Try:# java -classpath /usr/local/lib -Djava.library.path=/usr/local/lib/libsqlite_jni.so test
When I try java -classpath /usr/local/lib -Djava.library.path=/usr/local/lib/libsqlite_jni.so testI getException in thread "main" java.lang.NoClassDefFoundError: testbut the test class is there$ ls test.classtest.class
> I get
> Exception in thread "main"
> java.lang.NoClassDefFoundError: test
>
> but the test class is there
> $ ls test.class
> test.class
Your current directory isn't in your classpath, I guess. You'll also want to put the sqlite.jar file in your classpath:
java -classpath /path/to/sqlite.jar:. \
-Djava.library.path=/usr/local/lib/libsqlite_jni.so test
This may be neither here or there, but if you used [url=http://hsqldb.org/]HSQLDB[/url], you wouldn't be having this java.library.path headache ;).
> When I try java -classpath /usr/local/lib
> -Djava.library.path=/usr/local/lib/libsqlite_jni.so
> test
>
> I get
> Exception in thread "main"
> java.lang.NoClassDefFoundError: test
>
> but the test class is there
> $ ls test.class
> test.class
You should add current directory to the classpath (that is a dot)
kajbja at 2007-7-12 17:39:56 >

I'm still getting an error. It looks like it's looking for sqlite_jni - shouldn't it be looking in for libsqlite_jni ?
$ java -classpath /usr/local/share/java/sqlite.jar:. -Djava.library.path=/usr/local/lib/libsqlite_jni.so test
Unable to load sqlite: java.lang.UnsatisfiedLinkError: no sqlite_jni in java.library.path
Exception in thread "main" java.lang.UnsatisfiedLinkError: version
at SQLite.Database.version(Native Method)
at test.main(test.java:72)
Thanks for your help guys.this seemed to work:java -classpath /usr/local/share/java/sqlite.jar:. -Djava.library.path=/usr/local/lib/ test
> Thanks for your help guys.
>
> this seemed to work:
>
> java -classpath /usr/local/share/java/sqlite.jar:.
> -Djava.library.path=/usr/local/lib/ test
Good deal, glad it worked out. I thought you had to put the actual library on the java.library.path, so that's good to know. Take it easy, good luck.
i had the same error (but not with SQLite) , and it turned out i was missing a dll that the library required from the classpath