---
title: "How to setup Environment Variable:"  
description: "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"  
author: "Devesh Kumar Singh"  
published: 2015-10-28  
updated: 2018-03-13  
canonical: https://www.mindstick.com/blog/10970/how-to-setup-environment-variable  
category: "java"  
tags: ["java"]  
reading_time: 2 minutes  

---

# How to setup Environment Variable:

In this blog, I’m going to tell you how to setup System [Variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) for your java [program](https://www.mindstick.com/blog/12337/scaling-up-your-mentorship-program). It’s very important to do this because System Variable help to create and shape the [environment](https://yourviews.mindstick.com/view/308/need-to-create-a-supportive-work-environment-for-women) where a program runs. So let’s see how you can setup System Variable. Follow the given instructions step by step:

1) Open [Control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) Panel and go to System and [Security](https://www.mindstick.com/articles/43813/new-security-technologies) ->System. Here you will see on the left side of the screen an option-> [advanced](https://www.mindstick.com/articles/12993/5-advanced-features-for-your-odoo-ecommerce-theme) system settings. Click on it.

![How to setup Environment Variable:](https://www.mindstick.com/blogs/156b68f2-d498-4e41-aaf0-324f9dd868ad/images/d3a101cc-414e-4cb1-a6b0-9594178abf4d.png)

2) Click on Environment Variables.

![How to setup Environment Variable:](https://www.mindstick.com/blogs/156b68f2-d498-4e41-aaf0-324f9dd868ad/images/1eecfefc-43ee-4b84-a49e-5aea98328fb3.png)

3) Under System [variables](https://www.mindstick.com/articles/715/php-variables) find and click on PATH variable and then click on [edit option](https://answers.mindstick.com/qa/33673/i-want-to-change-payment-profile-address-and-name-but-not-show-edit-option-in-payment-manage-setting-in-google-adsence).

![How to setup Environment Variable:](https://www.mindstick.com/blogs/156b68f2-d498-4e41-aaf0-324f9dd868ad/images/8fe52080-79db-42cd-a857-c817cf03acf6.png)

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.

![How to setup Environment Variable:](https://www.mindstick.com/blogs/156b68f2-d498-4e41-aaf0-324f9dd868ad/images/67a97ae8-e8a2-4bb6-89de-141474f7c8dc.png)

![How to setup Environment Variable:](https://www.mindstick.com/blogs/156b68f2-d498-4e41-aaf0-324f9dd868ad/images/344e8781-c411-46bd-b10f-717d16ec48f5.png)

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

![How to setup Environment Variable:](https://www.mindstick.com/blogs/156b68f2-d498-4e41-aaf0-324f9dd868ad/images/134b957b-df14-4e35-ad1b-445cce891471.png)

6) Finally type java <[filename](https://www.mindstick.com/interview/23463/difference-between-include-filename-and-include-filename)> and press enter to [execute](https://www.mindstick.com/interview/49/how-can-i-execute-a-php-script-using-command-line) the program. You will see the desired output.

![How to setup Environment Variable:](https://www.mindstick.com/blogs/156b68f2-d498-4e41-aaf0-324f9dd868ad/images/eb71e6c4-6e6c-4f33-ba80-96cab2a34276.png)

---

Original Source: https://www.mindstick.com/blog/10970/how-to-setup-environment-variable

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
