Trivial problem, but the unexpected behavior is frustrating.
I have an application which requies a connection to a MySQL database. It's extremely happy if the mysql-connector-java-..-.jar file is in $JAVA_HOME/jre/lib/ext. Unfortunately, as Java is updated the above path points to a new, different directory, not housing said .jar file.
My thoughts on preventing this from happening were to place the connector within a directory and have the CLASSPATH point to it. My application, a .jar file itself, doesn't recognize the CLASSPATH, either as a system variable or through the command line (java -cp ... ). When the connector is not present within the ext directory, all attempts to provide its location through classpath are not acknowledged.
I wrote a very small class to test this issue - it just loads the driver and reports if it can be found. And it DOES obey the classpath, and can find the connector when the CLASSPATH is accurate (when the connector is not in the expected ext directory, which my jar file can't).
My program is an eclipse project, exported into a jar file. It is deployed on a SuSE machine. Current Java version is 1.4.2.10. Any hints on why the driver can't be found using Classpath when executing a [my] jar file?
Thanks,
Josh
I have an application which requies a connection to a MySQL database. It's extremely happy if the mysql-connector-java-..-.jar file is in $JAVA_HOME/jre/lib/ext. Unfortunately, as Java is updated the above path points to a new, different directory, not housing said .jar file.
My thoughts on preventing this from happening were to place the connector within a directory and have the CLASSPATH point to it. My application, a .jar file itself, doesn't recognize the CLASSPATH, either as a system variable or through the command line (java -cp ... ). When the connector is not present within the ext directory, all attempts to provide its location through classpath are not acknowledged.
I wrote a very small class to test this issue - it just loads the driver and reports if it can be found. And it DOES obey the classpath, and can find the connector when the CLASSPATH is accurate (when the connector is not in the expected ext directory, which my jar file can't).
My program is an eclipse project, exported into a jar file. It is deployed on a SuSE machine. Current Java version is 1.4.2.10. Any hints on why the driver can't be found using Classpath when executing a [my] jar file?
Thanks,
Josh