Md.Badruzzaman Nibir
Md.Badruzzaman Nibir

Reputation: 43

Do I need to set java JDK path in user variables or system variables?

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.

Upvotes: 4

Views: 11979

Answers (2)

scgrk
scgrk

Reputation: 159

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.

Upvotes: 5

Jessy Guirado
Jessy Guirado

Reputation: 228

The difference is user variables means the variable will only be able to be used & called by the user it was created by. On the other hand, for system variables, all users can use that variable.

I would recommend setting it to the system variables for compatibility, accessibility and less chance of creating errors of variable not found.

Upvotes: 1

Related Questions