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:
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:
java -classpath ".:sqlite-jdbc-v056.jar" ProgramName
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.