How To Set Environment Variable For Java - YouProgrammer

How To Set Environment Variable For Java [Windows 10, 8, 7, XP]

Environment variables are very important part of every system which defines the path to run a program Or specify to a program which directory or folder to install files. The Environment variables are dynamic and it is because they can change. The very common term that you may have heard as environment variables are %appdata% , %local% , %temp% , %userprofile% etc.

When it comes to java programming these enviournment vriables are the priority of it and you can’t go further without defining these.

How Environment Variables are important in Java Programming:

Once you have installed java on your windows system then in order to make java program or to compile them you need to set a path using environment variables. It helps you to use the tools inside java in command prompt, without defining path you can’t go further and it will give you the error like this is not recognized as an internal or external command.

To Set path in Java or to Set environment variable in Java for windows 10 and 8 follow below steps:

Copying the Path:

  1. Open File Explorer.
  2. Go to C>>Program Files>>Java>>jdk>>bin                                                                                                                        windows folders path area 
  3. Here you will see a number of files or tools, just copy the path it from the path area.                                              copy path of java idk windows
  4. Once you have copies the path follow the below Pasting process to set the environment variable.

Pasting the Path:

  1. Go to control panel using search Or using Run by pressing Windows+R key simultaneously, which will open run windows, now type Control Panel on it and Hit Ok.                                                                                                             control panel in run windows
  2. Once you are on the Control Panel, Click on Systems and Security.                                                                                           system and security windows control panel
  3. Under Systems and Security windows Go to System.                                                                                                                system in control panel
  4. Now, click on Advanced System Settings from the left side of the window.                                                                           advanced system settings control panel windows
  5. Under Systems Properties window click on Environment variables button.                                                                                  environment variables
  6. Now under the System Variables area, find the path variable and double click on it.                                                            path copy windows
  7. It will take you to the Edit Environment variable window, here click on New button from the right side.                                   new environment variable in windows
  8. Now paste the path you have copied, and hit Ok to every previous window to close them.

Note: Before going to C drive to copy path you must know where exactly the java is installed in your windows OS. Usually, we use C drive for that, but if your windows OS installed in other partition then look for the rest of the path there.

Once done with copying and pasting process then you can compile and run your java program. After all the above process you also can set path for other programs using the above steps, which will remains same most version of windows like windows 10, 8, 7, XP you have opened the control panel.

Leave a Reply