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 the Java development environment configured properly.

Set Path Environment Variable

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

Step 1:- Assuming that you have installed Java in the “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 settings” tab.

java-installation-9

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

java-installation-10

java-installation-11

Set classpath Environment Variable

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

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

java-installation-14

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

java-installation-12

Step 3:- Now, let’s open the terminal and run the following command in order to verify the 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.