I am new in java programming. I am currently using Windows. Recently I saw a video tutorial from YouTube that the instructor was setting java JDK path
in system variables then created a new variable called JAVA_HOME
.
Now I saw in javaTpoint tutorial
that they were setting the path in user variables didn't create any JAVA_HOME
variable.
So my question is what is the difference between the set path in user variables and system variables? Which one do I have to set? and what's all about JAVA_HOME
?
I didn't found any proper explanation on this. Your answer would be highly appreciated.
If you set it as a user variable, it's only available to the current user. If you set it as a system variable, it's available for all users. i.e. if you log out of Windows and log in with a different user, you won't have the JDK on your system path if you set it as a user variable. If it's your personal computer and you only have one account, it doesn't matter too much. I'd recommend setting it as a system variable.
JAVA_HOME
is used by Gradle and Maven build tools (and some other things) to know where the root directory of your JDK is located. It should point to the folder where the bin
folder is located, ie C:\Program Files\Java\jdk-11.0.7
. If you're just starting out, I wouldn't worry about it too much. It's not necessary until you start using more complex tools for development.