You need to set java JDK path in user variables or system variables.

huangapple go评论83阅读模式
英文:

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

问题

Setting path variables in Java programming can be done in either user variables or system variables.

User Variables:

  • These are specific to the user account you are currently using on your Windows system.
  • Changes made to user variables affect only that user's environment.
  • It's suitable for setting variables that are specific to your user account and don't need to be accessed by other users on the system.

System Variables:

  • These are global variables that affect all users on the Windows system.
  • Changes made to system variables affect the entire system's environment.
  • It's typically used for variables that should be accessible to all users and programs on the computer.

JAVA_HOME:

  • JAVA_HOME is an environment variable that points to the directory where Java is installed on your system.
  • It's often used by various Java applications and development tools to locate the Java installation directory.
  • Setting JAVA_HOME can be done in either user or system variables, depending on your requirements.
  • If you want all users and applications to use the same Java installation, set it as a system variable. If it's specific to your user account, set it as a user variable.

In summary, the choice between user variables and system variables depends on whether you want the variable to be specific to your user account or available to all users. JAVA_HOME is used to specify the location of your Java installation, and it can be set in either user or system variables, depending on your needs.

英文:

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.

答案1

得分: 5

如果您将其设置为用户变量,它仅对当前用户可用。如果将其设置为系统变量,则对所有用户可用。即,如果您退出 Windows 并使用不同的用户登录,如果将其设置为用户变量,则系统路径上将没有 JDK。如果这是您的个人计算机,且只有一个帐户,那就无所谓了。我建议将其设置为系统变量。

JAVA_HOME 由Gradle和Maven构建工具(以及其他一些工具)用于确定您的JDK的根目录位置。它应该指向bin文件夹所在的文件夹,即C:\Program Files\Java\jdk-11.0.7。如果您刚开始使用,不必过多担心它。除非开始使用更复杂的开发工具,否则不是必需的。

英文:

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.

答案2

得分: 1

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.

英文:

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.

huangapple
  • 本文由 发表于 2020年8月11日 11:43:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/63351184.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定