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, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
32 Comment threads
17 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
41 Comment authors
mkyongMishoAhmedAmadou DialloMaksim Novikov 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.

sameeee
Guest
sameeee

this is also my question, is there any explanations now as to why javac -version didn’t work?

Epredator
Guest
Epredator

when you write paths do it without any white spaces.

sameeee
Guest
sameeee

i now fixed it by adding a semicolon before appending it to the path.

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.

Vicky
Guest
Vicky

Thanks buddy.. This worked for me..

Guest
Guest
Guest

how to make it ‘%JAVA_HOME%bin’. I mean I can add a new path and give the path of my java Bin there. what else do I need to do?

Ankit Jain
Guest
Ankit Jain

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

mkyong
Guest
mkyong

Thanks for your shortcut, yes it works. Windows key + Pause Key will prompts the “advance system settings”

yogiraj tambade
Guest
yogiraj tambade

THANK YOU FOR SHORTCUT BROTHER—-

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.

srk
Guest
srk

i think you have only installed jre file.you should have to install jdk file too..

Misho
Guest
Misho

Thank you !

Amadou Diallo
Guest
Amadou Diallo

Thank you ,
for me it works

Maksim Novikov
Guest
Maksim Novikov

Hi, you say do not include “\bin” to path, but without bin directory it not working in my case (i use Windows 10)

Priyanka
Guest
Priyanka

Thanks Dear, It worked for me.

Yohan
Guest
Yohan

I love all your stuff cause it is clear and well explained. thank you

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

dsdfsdf
Guest
dsdfsdf

exactly the one I wanted, thankyou

zachu
Guest
zachu

Thanks that helped me a lot on Windows 10!

Viktoria
Guest
Viktoria

thanks fo you post

workneh
Guest
workneh

Thank you dear

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

mohsen
Guest
mohsen

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

Parin Shah
Guest
Parin Shah

thanks alot…you had the best explanaion..thanx

Mufas Mohammed Mydeen
Guest
Mufas Mohammed Mydeen

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

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.

ako
Guest
ako

thank you for your good post

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

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?

Ardika Darwis
Guest
Ardika Darwis

thanks it Works!~

PhanVu HoaiNam
Guest
PhanVu HoaiNam

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

Dominic Brain
Guest
Dominic Brain

thanks its help me 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?

mkyong
Guest
mkyong

Sorry, what is your problem?

master3395
Guest
master3395

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

mkyong
Guest
mkyong

You have to install or download Java manully it from Oracle – http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Mokh Akh
Guest
Mokh Akh

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

mkyong
Guest
mkyong

Restart your terminal.

Jerry Craig
Guest
Jerry Craig

I needed to restart also, should include this in the directions above?

Nomad Knight
Guest
Nomad Knight

10x, keep up the great work!

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

mkyong
Guest
mkyong

Try log in as administrator.