简体   繁体   English

Windows 10 - 系统环境变量(路径与路径)

[英]Windows 10 - system environment variables (Path vs. PATH)

I'm learning java, and had the jdk set as part of the Path system variable.我正在学习 java,并将 jdk 设置为Path系统变量的一部分。 When following a guide on how to install Maven, I created a PATH variable and set again the jdk to the PATH variable.在遵循有关如何安装 Maven 的指南时,我创建了一个PATH变量并再次将 jdk 设置为PATH变量。

The result was that the Path variable was deleted from the system (Windows 10).结果是从系统中删除了Path变量(Windows 10)。 In addition, the jdk and jre were also deleted from the location where they were installed ( C:\\Program Files\\Java ).此外,jdk 和 jre 也从它们的安装位置( C:\\Program Files\\Java )中删除。 I reinstalled the jdk and jre, and defined a new PATH variable.我重新安装了 jdk 和 jre,并定义了一个新的PATH变量。 for now, I can run java and eclipse, and did not experience any issues.现在,我可以运行 java 和 eclipse,并且没有遇到任何问题。

My questions:我的问题:

  1. Is there any difference between PATH and Path ? PATHPath之间有什么区别吗?
  2. Path variable had many programs set to it (I don't remember which programs). Path变量设置了许多程序(我不记得是哪些程序)。 Now that it no longer exists, what would be the implications?现在它已经不存在了,会有什么影响?
  3. What could be the reason that Path variable was deleted? Path变量被删除的原因可能是什么?

Thanks, Oren谢谢,奥伦

1) PATH and Path are the same since Windows environment variables are case insensitive ( File paths in Windows environment not case sensitive? ). 1) PATHPath相同,因为 Windows 环境变量不区分大小写( Windows 环境中的文件路径不区分大小写? )。

2) Windows use Path to locate executables that are not located in the "current folder". 2) Windows 使用Path来定位不在“当前文件夹”中的可执行文件。 For instance, when you type "java.exe" on the command line, Windows will first try to find a local executable file with this name on the directory path you are at.例如,当您在命令行中键入“java.exe”时,Windows 将首先尝试在您所在的目录路径上查找具有此名称的本地可执行文件。 If it can't find it there, Windows will then look for this file in another places.如果在那里找不到它,Windows 会在其他地方寻找这个文件。 At some point of this search it will look for the file inside every directory entry of Path variable, from the first to the last.在此搜索的某个时刻,它将在Path变量的每个目录条目中查找该文件,从第一个到最后一个。 That's why Path is a list of paths where order matters.这就是为什么Path是一个顺序很重要的路径列表。

If you have removed or empty the Path variable, maybe there will be some side effect over some previously third party installed program, since it's executables won't be found outside their installation folder.如果您已删除或清空Path变量,则可能会对某些先前第三方安装的程序产生一些副作用,因为在其安装文件夹之外找不到可执行文件。

3) Problably you deleted it by accident when trying to set up the Java environment. 3) 可能是您在尝试设置 Java 环境时不小心删除了它。 It's difficult to guess...很难猜...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM