Java 无法以管理员身份更改 Windows 10 中的系统变量路径

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34116833/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 15:20:20  来源:igfitidea点击:

Unable to change system variable path in Windows 10 as an Admin

javawindows

提问by Danielle Rose Mabunga

I am installing Java JDK in Windows 10 machine that requires registering its path by editing System Variables in Windows settings, but I tried both as an admin and regular user and it doesn't allow me to add the path, even copy paste or just adding any character.I have no trouble doing this in Win 8 until I am 'tempted' to avail and run free upgrade by Microsoft.

我正在 Windows 10 机器上安装 Java JDK,需要通过在 Windows 设置中编辑系统变量来注册其路径,但我以管理员和普通用户的身份进行了尝试,但它不允许我添加路径,甚至复制粘贴或只是添加任何角色。我在 Win 8 中执行此操作没有任何问题,直到我“很想”利用 Microsoft 并运行免费升级。

Q1:

问题 1:

Is this A bug in Windows 10? I update my machine regularly and also auto update is turned on to ensure to get the latest fix from Microsoft. Kaspersky is also disabled temporarily.

这是 Windows 10 中的错误吗?我定期更新我的机器,并且自动更新已打开以确保从 Microsoft 获得最新修复。卡巴斯基也被暂时禁用。

Q2:

问题 2:

How do you edit the system variable in Win 10 machine? I am planning to downgrade my Machine to windows 7 or 8 if this issue is not fixed.

在Win 10机器中如何编辑系统变量?如果此问题未解决,我计划将我的机器降级到 Windows 7 或 8。

Any ideas?

有任何想法吗?

采纳答案by Danielle Rose Mabunga

If you cant edit system variable under Path in windows 10, try this instead

如果您无法在 Windows 10 中的 Path 下编辑系统变量,请尝试使用此方法

enter image description here

在此处输入图片说明

Login as administrator

以管理员身份登录

go to your Java folder e.g

转到您的 Java 文件夹,例如

C:\Program Files\Java\jdk8\bin and copy.

Now in search box beside windows logo at the bottom type

现在在底部 Windows 徽标旁边的搜索框中键入

path 

and select the one that says

并选择一个说

'edit the system environment variables'

This is important, select 'New' tab in User variables for Administrator, not the 'New' tab from 'System variables' as you cant edit it.Now name it as you wish, mine is PATH.Now copy and paste the path where you installed Java, mine is under

这很重要,在管理员的用户变量中选择“新建”选项卡,而不是“系统变量”中的“新建”选项卡,因为您无法对其进行编辑。现在按您的意愿命名,我的是 PATH。现在复制并粘贴路径你安装了 Java,我的在下

 c:\Program Files\Java\jdk8\bin

Hit ok to exit.

点击确定退出。

Restart your command line and test Java

重新启动命令行并测试 Java

 java -version

it should tell you java version and Java is successfully installed and accessible.Start using it and cheers

它应该告诉你 Java 版本和 Java 已成功安装和访问。开始使用它并欢呼

回答by Lewis Parker

I also faced similar problem after installation of new JDK and following steps resolved the issue:-

安装新 JDK 后我也遇到了类似的问题,以下步骤解决了这个问题:-

  1. Copy the entire content of path System variable in notepad and see if there is any path related to Java.
  2. Delete all the path related to Java.
  3. Click Ok.
  4. Now you can edit the Path without any issue.
  1. 在记事本中复制path系统变量的全部内容,看看是否有与Java相关的路径。
  2. 删除所有与Java相关的路径。
  3. 单击确定。
  4. 现在您可以毫无问题地编辑路径。

If these steps doesn't work than you can create a new Variable.

如果这些步骤不起作用,您可以创建一个新变量。

回答by Jake Sams

When I was trying to add a new path to my system variables, I was unable to select the edit button. To get to system variables I went to my search bar and selected "edit environmental variables for your account." When i did this, the edit button was grayed out and I couldn't add a new path. To fix this i typed in my search bar and selected "edit the system environment variables" once that box comes up right above the ok button select "click environmental variables". Yay, the path edit button is no longer grayed out. Hope this helps

当我尝试向系统变量添加新路径时,我无法选择编辑按钮。要获取系统变量,我转到了搜索栏并选择了“为您的帐户编辑环境变量”。当我这样做时,编辑按钮变灰,我无法添加新路径。为了解决这个问题,我在我的搜索栏中输入并选择“编辑系统环境变量”,一旦该框出现在确定按钮的正上方,选择“单击环境变量”。是的,路径编辑按钮不再变灰。希望这可以帮助

回答by user3599207

My situation is a bit different as I use a small 7" windows tidy notebook called "one-notebook (One MIX)". It seems the "OK" key is not shown in the 2nd stage in horizontal position and you need to rotate the screen to see the OK. Spend a lunch time for that.

我的情况有点不同,因为我使用了一个名为“one-notebook (One MIX)”的小型 7" windows tidy notebook。似乎“OK”键没有显示在水平位置的第二阶段,您需要旋转屏幕看到 OK。花一个午餐时间。

回答by Shubham_serva

There is a simple solution if your global environment variables are disabled. Follow these steps to open it in admin mode :

如果您的全局环境变量被禁用,有一个简单的解决方案。按照以下步骤在管理员模式下打开它:

  1. Win Key + X.
  2. Y
  3. search Advance System Settings and open it.
  4. Now select environment variables.
  1. 胜利键 + X。
  2. 搜索高级系统设置并打开它。
  3. 现在选择环境变量。

Upvote if this is working to help others.

如果这有助于帮助他人,请点赞。