How to set JAVA_HOME on Windows 10?

摘要: This tutorial shows you how to set a JAVA_HOME system variable on Windows 10.

This tutorial shows you how to set a JAVA_HOME system variable on Windows 10.

Tested with :

  1. Windows 10
  2. JDK 1.8

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

Select Advance tab, clicks Environment Variables


In System variables, clicks 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 example

  1. Correct – C:\Program Files\Java\jdk1.8.0_60
  2. Wrong – C:\Program Files\Java\jdk1.8.0_60\bin

4. 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

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\mkyong>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\mkyong>javac -version
javac 1.8.0_60
C:\Users\mkyong>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_60


  1. How to Set $JAVA_HOME environment variable on Mac OS X
  2. How to Open the Control Panel in Windows 10
  3. Java SE Development Kit 8 Downloads

上一篇: Python Check if key exists in dictionary
下一篇: Java 8 forEach examples
 评论 ( What Do You Think )


  • 微信公众号

  • 我的微信


1、一号门博客CMS,由Python, MySQL, Nginx, Wsgi 强力驱动

2、部分文章或者资源来源于互联网, 有时候很难判断是否侵权, 若有侵权, 请联系邮箱, 同时欢迎大家注册用户,主动发布无版权争议的 文章/资源.

3、鄂ICP备14001754号-3, 鄂公网安备 42280202422812号