I am running ubuntu. I installed sqlite3 and java through the synaptic package manager and downloaded the jar sqlitejdbc-v056.
My sqlite is working fine. I wrote java code that compiles but does not start. I used ant to compile the material, and it worked fine as soon as I put the jar in the same place as build.xml.
When I try to run the program (saying a java program), it says: java.sql.SQLException: No suitable driver was found for jdbc: sqlite: test.db
Here are some of the code violators:
Class.forName("org.sqlite.JDBC"); Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");
From what I read so far, this is probably a problem with my classpath, I'm not quite sure how to fix it. here is what i tried:
- put .jar in the same directory as the main compiled main program file
- put the .jar in the same directory as my compiled class that uses sql stuff
- tried using the -classpath option when calling java from terminal. First I tried this with relative addressing, then with an absolute path
- 3, but with wildcards, i.e. ... / *. 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 have no options.
on a separate but related note, I also tried very hard to get javac to see the jar at compile time, I also could not get the ant material about the class path. This part is not as urgent as above, but here is a little build.xml:
<path id="files-classpath"> <fileset dir="lib/" > <include name="*.jar"/> </fileset> </path>
...
These are just some of the things I've tried.
Any ideas would be highly appreciated, the Internet has surprisingly little information on this topic from what I see ...
source share