Hey everyone. I'm trying to use csvjdbc.jar, a driver for reading
comma-separated flat-files as a database (search on sourceforge for
csvjdbc). In the example code that I have, it says to include the
following line:
Class.forName("org.relique.jdbc.csv.CsvDriver");
However when I run the app, it throws this error:
ClassNotFoundException: org.relique.jdbc.scv.CsvDriver
I'm sure my classpath is set correctly. Anybody else run into this
problem? Any help would be appreciated. Thanks
jagonzal@gmail.com - 27 Jul 2006 22:42 GMT
> Hey everyone. I'm trying to use csvjdbc.jar, a driver for reading
> comma-separated flat-files as a database (search on sourceforge for
[quoted text clipped - 9 lines]
> I'm sure my classpath is set correctly. Anybody else run into this
> problem? Any help would be appreciated. Thanks
ClassNotFoundException would indicate that either there's a typo in the
class name supplied, or your classpath isn't correctly set.
jagonzal@gmail.com - 27 Jul 2006 23:38 GMT
> Hey everyone. I'm trying to use csvjdbc.jar, a driver for reading
> comma-separated flat-files as a database (search on sourceforge for
[quoted text clipped - 9 lines]
> I'm sure my classpath is set correctly. Anybody else run into this
> problem? Any help would be appreciated. Thanks
Is that Exception copy-pasted from your console? Because it looks like
you have a typo in the class name (it reads "scv" where it should be
"csv")
MyClue - 28 Jul 2006 15:33 GMT
aah no not copy pasted so that typo was when i made this message.
here's the copy-paste text
java.lang.ClassNotFoundException: org.relique.jdbc.csv.CsvDriver
> > Hey everyone. I'm trying to use csvjdbc.jar, a driver for reading
> > comma-separated flat-files as a database (search on sourceforge for
[quoted text clipped - 13 lines]
> you have a typo in the class name (it reads "scv" where it should be
> "csv")
jagonzal@gmail.com - 28 Jul 2006 16:07 GMT
> aah no not copy pasted so that typo was when i made this message.
> here's the copy-paste text
>
> java.lang.ClassNotFoundException: org.relique.jdbc.csv.CsvDriver
How are you defining your classpath? ClassNotFoundException should not
be thrown if the csvjdbc jar was in the classpath.
MyClue - 28 Jul 2006 19:24 GMT
i've tried moving the .jar from the set classpath to the same dir as
the .class (and running java -cp . blabla
neither seems to work. i tried the same thing with another driver,
xmljdbc and that one doesn't work either.
> > aah no not copy pasted so that typo was when i made this message.
> > here's the copy-paste text
[quoted text clipped - 3 lines]
> How are you defining your classpath? ClassNotFoundException should not
> be thrown if the csvjdbc jar was in the classpath.
jagonzal@gmail.com - 28 Jul 2006 20:03 GMT
> i've tried moving the .jar from the set classpath to the same dir as
> the .class (and running java -cp . blabla
>
> neither seems to work. i tried the same thing with another driver,
> xmljdbc and that one doesn't work either.
At the risk of pointing out the blatantly obvious, it is not enough to
point to the directory - you must explicitly name the jar in the
classpath:
Test.java:
public class Test {
public static void main(String args[]) throws Exception{
Class.forName("org.relique.jdbc.csv.CsvDriver");
System.out.println("I'm ok!");
}
}
jgonzalez@jambi ~/downloads/csvjdbc-r0-10 $ java Test
Exception in thread "main" java.lang.ClassNotFoundException:
org.relique.jdbc.csv.CsvDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at Test.main(Test.java:3)
jgonzalez@jambi ~/downloads/csvjdbc-r0-10 $ java -classpath
.:csvjdbc.jar Test
I'm ok!
Note that the "classpath" isn't just "." - it explicitly names
csvjdbc.jar as a separate classpath element from "."
MyClue - 28 Jul 2006 20:34 GMT
aah, thanks a bunch.
<-- beginner ;)
> > i've tried moving the .jar from the set classpath to the same dir as
> > the .class (and running java -cp . blabla
[quoted text clipped - 36 lines]
> Note that the "classpath" isn't just "." - it explicitly names
> csvjdbc.jar as a separate classpath element from "."
jagonzal@gmail.com - 28 Jul 2006 21:15 GMT
> aah, thanks a bunch.
> <-- beginner ;)
Glad to be of help ;)