Web Info and IT Lessons Blog...

Thursday 14 May 2015

How to set environment variable in windows 8?



Environment variables are used to store the path locations of processes that run on a system. Like for example, TEMP environment variable stores the path of location to store temporary files. If you have JDK (Java Development Kit) installed on your system but you have not set the environment variable for java and you run the command javac in command prompt, you will get an error even though you have installed JDK. This is because your system can not find out javac at the path locations previously set in the Path environment variable. We need to store the location of our JDK in the Path environment variable to let the system know where javac exists.

To set the environment variable, go to the control panel of your system. Your screen should look like the image given below:

Control Panel Windows8

Click on System and Security and then click on System. Now click on Advanced System Settings under Control Panel Home in the side menu. Now you should be looking at a window similar to the one given in the below image:

System Properties

Click on Advanced and then click on Environment Variables button.

Environment Variables

Now you can see all the environment variables listed in front of you. To set the Path variable click on Path variable under System variables and then click on edit button.

Path Environment Variable

There will be already some path locations saved in this variable, do not remove any path locations, just paste your new path value at the end and save it. My path location of jdk was:


C:\Program Files\Java\jdk1.8.0_45\bin

Your location should be something similar to mine.

How to check the value of an environment variable through command prompt?

It is very easy to check the value of an environment variable through command prompt. Just run your command prompt and execute the following command to check the value of an environment variable.


C:\> echo %Variable Name%

Let us say we want to check the value of Path variable, we need to run the following command in the command prompt:


C:\> echo %Path%

The output of the above command should look similar to the image given below:

Path Location

Stay tuned for more lessons...

No comments:

Post a Comment