I’m running ubuntu. I installed sqlite3 and java via the synaptic package manager, and downloaded the sqlitejdbc-v056 jar.
My sqlite is working fine. I’ve written some java code that compiles, but wont run. I used ant to compile the stuff and that worked fine once i put the jar in the same place as build.xml.
When i try to run the program (by saying java program) it says: java.sql.SQLException: No suitable driver found for jdbc:sqlite:test.db
here’s some of the offending code:
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");
From what I’ve read thus far it’s probably a problem with my classpath, i’m not really sure how to fix it though. here’s what i’ve tried:
- put the .jar in the same directory as my compiled program main stuff
- put the .jar in the same directory as my compiled class that uses the sql stuff
- tried using the -classpath option when calling java from the terminal. I tried this with relative addressing first, then an absolute path
- 3 but with wildcards, ie …/*.jar
- sudo gedit /etc/environment. there was no CLASSPATH so i put this in: CLASSPATH=”.jar:/home/sheena/Java/lib/.jar:.:.*.jar:/home/sheena/Java/lib/”
I feel like i’m out of options.
on a separate but related note, i also really struggled to get javac to see the jar while i was compiling, i couldn’t get the ant stuff about the classpath right either. This part isn’t as urgent as the stuff above but here’s a little bit of build.xml:
<path id="files-classpath">
<fileset dir="lib/" >
<include name="*.jar"/>
</fileset>
</path>
…
those are just some of the things i tried.
Any ideas would be much appreciated, the internet has surprisingly little info on this topic from what i can see…
try running it like this:
the “.:” is very important (i wasn’t sure if your tried that or not from your description). also i just guessed what the name of your .jar is, but obviously change it to reflect the actual name.