在用户变量和系统变量中设置 Java 的路径有什么区别?

What is the difference between setting the path for Java in user variables and system variables?

我正在 windows 上安装 Java。我想知道在用户变量中为 Java 设置路径和在系统变量中设置它的区别?

系统变量在机器上的所有用户之间共享。用户变量特定于单个用户。

最终两者的效果是一样的,要看谁需要在机器上使用Java。

如果您在 user variables 中设置路径,则该路径仅对用户可见。在 system variables 中,此路径对所有用户可见。

Right-click My Computer and go to Properties->Advanced->Environmental Variables...

上面是user variables,下面是system variables。在为应用程序创建环境时组合这些元素。系统变量为所有用户共享,但用户变量仅供您 account/profile.

Environment variables 是 'evaluated'(即它们的属性),顺序如下:

System variables
Variables defined in autoexec.bat
User variables

简单来说,

System environment variables are global to all users, while users environment variables are specific only to the currently logged in user.

系统变量=所有用户, 用户变量 = 其帐户用于设置的用户。