Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding jdbc driver to classpath

Ok I am on Win Vista and correctly set my MAVEN_HOME, JAVA_HOME stuff. but I do not have a class path yet. I have also installed MySQL. now I have opened a Hibernate book and at the very first pages it says "make sure the jdbc driver is in your classpath" . I have also downloaded some Zip file that is ConnectorJ or some name like that which is basically the mySql driver for java... but my problem for now is this sentence that I have no clue how to do it: "make sure the jdbc driver is in your classpath" would you please help me about this classpath thing?

thanks

like image 267
Bohn Avatar asked Jun 22 '11 02:06

Bohn


1 Answers

Here is a good tutorial regarding, setting the class path. Further you might like to read Managing the Java classpath (Windows).

Having said that, you should not set the classpath for your driver in Windows environment variable. Instead, you should include that driver jar inside your IDE under project properties. But I noticed that you are actually using Maven. In this case you should look for the driver under Maven in order to fulfil that dependency. Maven will download the driver jar, if doesn't exist, and make it local.

In case, you are not using any IDE, then you can create a lib directory and tell the compiler that all required jars are in there, at the time of compilation/execution. You can find HOW, in the former link given above.

like image 68
Adeel Ansari Avatar answered Sep 22 '22 08:09

Adeel Ansari