Setting up Java, MySQL and JDBC Driver Connector Path

In this tutorial you will learn:

1. What is Java Path?
2. How to set Java Path?
3. How to set JDBC Driver Path?

What is Java Path?

Java Path is a location which tells Java Compiler to look for Java Library. Only installing Java is not enough until you tell compiler, the location of java folder. Once you set Java Path the java compiler is able to look for referenced class in Java folder. It is not tough to set Java Path in windows. There are three types of Environment which need to setup before proceeding next.

JAVA_HOME: This environment variable point the JDK Directory. It is C:\Program Files\Java\jdk_version.

CLASSPATH: This environment variable point JRE (Java Runtime Environment) Library. It is C:\Program Files\Java\jdk_version\jre\lib

PATH: This environment variable point JRE (Java Runtime Environment) bin folder. It is C:\Program Files\Java\jre_version\bin.

Installing Java and Setting Path

Here is detailed guide of installing java and setting proper path with step by step pictorial guide. You must go through this article to installing and setting Java Path with ease.

Java Installation And Path Setting With Screenshots

Installing and Setting JDBC Driver

To work with database it is necessary to install MySQL Database and JDBC Driver for MySQL. Here I will show you step by step guide to installing MySQL and Setting JDBC Driver for it.

Installing MySQL

You may download and Install MySQL but in my recommendation you download and install Wamp or XAMPP Server. Installing WAMP server will also install MySQL and PhpMyAdmin and gives you visual way to organize database in web browser. Using PHPMyAdmin you can create, update table or database easily. Here, is the way to install and use PhpMyAdmin in Windows PC.

Here is a great article describing How to install WAMP Server in Windows PC with Step by Step Pictorial Guide.

https://make.wordpress.org/core/handbook/tutorials/installing-a-local-server/wampserver/

After finishing installation you can open phpmyadmin by typing following url in your web browser.

http://localhost/phpmyadmin

Provides login id and password which you have set when installing WAMP. If not sure what is the id and password for MySQL or PHPMyAdmin Try this.

ID: root
Password: Blank (Keep password field blank)

Setting JDBC Driver

Step 1 : Download MySQL Java Connector from Here:

https://dev.mysql.com/downloads/connector/j/

Step 2: Extract it and then Copy and Paste folder in this location.

C:\Program Files\Java\jdk1.8.0_65

Step 3: Set class path for driver.

Right click on MyComputer icon > Properties > Select Advanced System Settings in left panel.

mycomputer properties

Go to Advanced Tab and click Environment variable.

Now find Path in the variable name and select it. Then click on Edit.
Java Path

Now, Go to end of the line. Place semicolon (;) at the end of the line and then paste the full path of java connector. It is like to be:

C:\Program Files\Java\[connector_folder_name]\mysql-connector-java-5.1.40-bin.jar

Click OK to Save.

Summary

In this chapter you learned how to set JAVA and JDBC Environment for developing database project in windows machine. However, it is upon you how you configure your machine and which editor you use for developing Java.


Leave a Reply

Your email address will not be published. Required fields are marked *