In this blog, I’m going to tell you how to setup System Variable for your java program. It’s very important to do this because System Variable help to create and shape the environment where a program runs. So let’s see how you can setup System Variable. Follow the given instructions step by step:

1)    Open Control Panel and go to System and Security ->System. Here you will see on the left side of the screen an option-> advanced system settings. Click on it.



2)      Click on Environment Variables.


3)  Under System variables find and click on PATH variable and then click on edit option.

4)   Now a new Edit System Variable window will open. Modify the PATH value, i.e. Variable_value, by adding the value to your JDK bin path, e.g. “C:\Program Files (x86)\Java\jdk1.8.0_31\bin” (This value may differ on your system) and click on all ok’s. And if you do not have the item PATH, select add a new variable and add PATH as the name and the location of the JDK bin as the value.


5)    You are done setting up your system variable for your Java. In order to test it go to command prompt and type javac <>. In my case it’s “” and press enter to compile the program. But before that, please don’t forget to specify the path where your java file is stored.



6)    Finally type java <filename> and press enter to execute the program. You will see the desired output.





  Modified On Mar-13-2018 04:11:59 AM

Leave Comment