How to set JAVA_HOME 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

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

  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

Note
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

References

  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

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
52 Comment threads
31 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
73 Comment authors
swapnaKanthasalih kutKOnsvipin kumar Recent comment authors
newest oldest most voted
Radhnatha
Guest
Radhnatha

Hii,
Mkyong i have windows 10 .i have installed jdk1.8.0_77 and also include jre1.8.0_77.first i setup envirment as your avobe instruction.Then i go to cmd promt type java -version run successfully but when i type javac -version error is occured i.e ‘javac’ is not recognized as an internal or external command,

operable program or batch file.

Joshua
Guest
Joshua

Windows 10 Path-section fix.

If you click edit on the paths section and it has 4 of them or more, just ADD a new path and make it the ‘%JAVA_HOME%bin’
This is what worked for me, there was nothing for me to add it to the end to that was similar to the video, but I made it it’s own option and it worked.

lenny
Guest
lenny

Hi Mykong.
when i type ‘echo %JAVA_HOME%’ I only get ‘ %JAVA_HOME%’ as the response

dinesh
Guest
dinesh

javac -version not worked for me windows 10 latest i m using

Ankit Jain
Guest
Ankit Jain

Windows+pause key works in windows 10? because that can also help in opening advance system settings dialog…

Mohamed Ahmed
Guest
Mohamed Ahmed

javac -version doesn’t work. I made HOME_JAVA and edited the path. My path when editing is not in the same interface as yours. Instead of one long it is divided in multiple lines and put the %JAVA_HOME%bin as the last line. But still doesn’t work.

Carlos
Guest
Carlos

Hi Mykong.
when i type ‘echo %JAVA_HOME%’ I only get ‘ %JAVA_HOME%’ as the response

Chellapandi Arumugam
Guest
Chellapandi Arumugam

In my laptop having both JDK as well as JRE, I can able to check installation of java via CMD. I can’t change the Path address in System Environment.
what can i do?
After windows 10 update i can use netbeans, i’m trying to install that but it produce NULLNULL error while installing.
anyone help me. I’m tried lot. i need help

Nomad Knight
Guest
Nomad Knight

10x, keep up the great work!

Mokh Akh
Guest
Mokh Akh

thanks a lot for this info you save me …
Note : it working fine after restart my pc .

master3395
Guest
master3395

What if java isn’t listed there, yet you have installed java on Windows 10?

Dominic Brain
Guest
Dominic Brain

thanks its help me lot

PhanVu HoaiNam
Guest
PhanVu HoaiNam

Thank you very much. Can I share it on my blog?

Ardika Darwis
Guest
Ardika Darwis

thanks it Works!~

kushagra sharma
Guest
kushagra sharma

in window 10 there is no java_home in advance setting, but created new. still i didn’t get path for java_home, what should i do?

Anshu Prince
Guest
Anshu Prince

I have followed all the steps.Its working correctly still theres an error launching android studio .says no jvm found

ako
Guest
ako

thank you for your good post

Naveen Kumar
Guest
Naveen Kumar

there is nothing in my system variables as path to edit. what should I do? javac command is working in cmd but when I try to compile my program it says not found.

Mufas Mohammed Mydeen
Guest
Mufas Mohammed Mydeen

I am using java 1.7. How to set java 7 path in windows 10 ?

Parin Shah
Guest
Parin Shah

thanks alot…you had the best explanaion..thanx

mohsen
Guest
mohsen

i did all of that but when i wana to use in the eclipse it doesnt exist.why?

Shivya
Guest
Shivya

After opening my eclipse its showing “failed to load the JNI shared library” and a path is given.. Can u help me wht to do

workneh
Guest
workneh

Thank you dear

Viktoria
Guest
Viktoria

thanks fo you post

zachu
Guest
zachu

Thanks that helped me a lot on Windows 10!

dsdfsdf
Guest
dsdfsdf

exactly the one I wanted, thankyou

abby
Guest
abby

hi
I tried to update my path to in the system variable to add the (%Java_Home%/bin;) but the path is not editable. and also there`s nothing on my system that says “Mkyong” i don’t know if i am doing something wrong . some please help me

Rai
Guest
Rai

Hi i deleted “path” in system variable how can i regain it……plzz…..help me sooon…it become i week still i cannot solve..feeleing frustrated….

Sam
Guest
Sam

Thanks a lot!!!!!!!!!!!!!!!!!

cem766
Guest
cem766

Hi Everyone and Mkyong, Java SE 8 jdk8u_66 I want to set up to Windows 10, I can’t make the JVM, set beyond the flesh I can’t do, please help you be?