This tutorial shows you how to set a JAVA_HOME system variable on Windows 10.
Tested with :
- Windows 10
- JDK 1.8
JAVA_HOME system variable on Windows 10.1. Advanced System Settings
Type advanced system settings in the search box (beside the Windows start button), clicks View advanced system settings.
2. Environment Variables
advanced system settings in the search box (beside the Windows start button), clicks View advanced system settings.
Select Advance tab, click Environment Variables
Advance tab, click Environment Variables3. Add JAVA_HOME
In System variables, clicks New... button to add a new JAVA_HOME variable and point it to the JDK installed folder.
Note
Don’t include the \bin folder, just the JDK path. For example
- Correct – C:\Program Files\Java\jdk1.8.0_60
- Wrong – C:\Program Files\Java\jdk1.8.0_60\bin
New... button to add a new JAVA_HOME variable and point it to the JDK installed folder.Don’t include the
\bin folder, just the JDK path. For example4. Update PATH
In System variables, find PATH, clicks edit... button :
4.1 In old version of Windows, it will prompt you below dialog box to edit the values directly, append this %JAVA_HOME%\bin; to the end of the line.
4.2 In latest Windows 10, it will prompt you below dialog box, clicks on New button, and add this %JAVA_HOME%\bin
Note
Puts the %JAVA_HOME%\bin in PATH make all the Java’s commands (java, javac, jstack and etc) are accessible from everywhere.
In System variables, find
PATH, clicks edit... button :
4.1 In old version of Windows, it will prompt you below dialog box to edit the values directly, append this
%JAVA_HOME%\bin; to the end of the line.New button, and add this %JAVA_HOME%\bin
Puts the
%JAVA_HOME%\bin in PATH make all the Java’s commands (java, javac, jstack and etc) are accessible from everywhere.5. Test
Open a command prompt, type :
C:\Users\rchennub>java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
C:\Users\rchennub>javac -version
javac 1.8.0_60
C:\Users\rchennub>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_60
C:\Users\rchennub>java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
C:\Users\rchennub>javac -version
javac 1.8.0_60
C:\Users\rchennub>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_60




No comments:
Post a Comment
Note: Only a member of this blog may post a comment.