Java Environment Setup

In this tutorial you will learn about the Java Environment Setup and its application with practical example.

Java Environment Setup

Once the installation is done, you are required to set some of the following path variables in order to have java development environment configured properly.

Set Path Environment Variable

You are required to set PATH environment variable in order to run any of the the java executable (javac.exe, java.exe, javadoc.exe, and so on) from any directory.

Step 1:- Assuming that you have installed Java in “C:\Program Files\Java\jdk1.8.0_91\bin” directory

java-installation-15

Step 2:- Right-click on “My Computer” and select “Properties”

java-installation-8

Step 3:- Click on the ‘Environment variables’ button under the ‘Advanced’ or “Advance system setting” tab.

java-installation-9

Step 4:- Now add or edit the ‘Path’ variable so that it also contains the java path as following –

java-installation-10

java-installation-11

Set classpath Environment Variable

You are also required to set classpath environment variable to specify the location for java class files in order to have java development environment configured properly. This variable actually specify the location of the rt.jar file which generally located at jdk\jre\lib.

Step 1:- Assuming that rt.jar file is located in “C:\Program Files\Java\jdk1.8.0_91\jre\lib” directory

java-installation-14

Step 2:- Let’s , open Environment variable window again and click on new to add a new path variable as “classpath” and put the complete path upto C:\Program Files\Java\jdk1.8.0_91\jre\lib\rt.jar

java-installation-12

Step 3:- Now, lets open the terminal and run the following command in order to verify classpath variable setting.

java-installation-13

 

In this tutorial we have learn about the Java Environment Setup and its application with practical example. I hope you will like this tutorial.