java.lang.ClassNotFoundException: org.sqlite.JDBC error in Sample.java program from xerial

Thanks to user phew for the help/ideas.

I missed the obvious command line instructions on Xerial’s site for the Sample program. To get the program to run from the command line, I had to copy the JAR file into the same folder as the .CLASS file. Then run the following command:

java -classpath ".:sqlite-jdbc-(VERSION).jar" Sample

Inside the quotation marks are multiple paths, separated thru a colon (:) under Unix and a semicolon (;) under Windows. The dot as one of the paths is important – only naming the JAR file alone is not enough. A full call on Windows would be:

"%JAVA_HOME%\bin\java.exe" -cp "sqlite-jdbc-(VERSION).jar;." Sample

Note the semicolon instead of the colon. The order of the paths do not really matter, and -cp does the same as -classpath, just shorter.

Leave a Comment