Pages

Wednesday, February 14, 2018

Java environment variables JAVA_HOME and PATH setup on windows 10

In this post, we will learn to setup java environment variables JAVA_HOME and PATH on windows 10 operating system.
To learn Java environment setup on windows 7 then click here

Java environment setup

Step 1)  Download and install java

Download and install appropriate Java SE Development Kit as per your windows operating system.
link: http://www.oracle.com/technetwork/java/javase/downloads/


Step 2) Setting JAVA_HOME and PATH

To compile and execute, java program needs the java environment i.e. java installation path.
You can specify java installation path by setting two properties JAVA_HOME and PATH.
There are two ways you can set properties :
  •  Command prompt 
    • Click "Search the web and Windows"  to search "cmd" and open command prompt.
    • Set Java_Home and Path as follows :
                        c:\> setx JAVA_HOME "{java_installation_path}"
                        c:\> setx PATH "%PATH%;%JAVA_HOME%\bin"


    • Then check java version using the following command :
                        c:\> java -version

                      Example :



Command Prompt
  •  GUI
    • For Windows 10: Click "Search the web and Windows"  to search "This PC" then right click on "This PC" >> "Properties" to open system panel.
    Search Result

    • Click on "Advance system settings" to open "System Properties tab" 


    System Panel

    • Go to "Advanced" tab on System Properties and click  "Environment Variables".


    System Properties Tab

    • Click on "New". 


    Environment Variables

    • Variable Name : JAVA_HOME and                                             Variable value :{java_installation_path} and then click OK.


    Add New User Variable

    • To set path, click existing variable "Path" >> click edit >> click on "New" to add java path and click OK.


    Add java path

    • Then check java version using the following command :
    •                         c:\> java -version
       
    Java Version Check


After following above steps you will be able to setup java environment variables java_home, path and you can start writing and executing a java program.

No comments:

Post a Comment