简体   繁体   English

为Java路径设置用户路径变量

[英]Setting User Path Variable for Java Path

At my work I have user access with no admin privileges. 在我的工作中,我具有没有管理员权限的用户访问权限。 My environment variable points to an old JDK at the current path: C:\\ProgramData\\Oracle\\Java\\javapath 我的环境变量指向当前路径下的旧JDKC:\\ProgramData\\Oracle\\Java\\javapath

From what I read on different posts such as this which states that all user variables override the environment variable except the PATH variable in which it concatenates the environment variable and user variable together. 从我在不同的岗位,如读其中规定,所有用户变量覆盖环境变量 ,除了在它加到环境变量和用户变量一起PATH变量。 I have followed many different tutorials and currently have my variables set up like this in my user PATH variable. 我遵循了许多不同的教程,目前在我的用户PATH变量中设置了这样的变量。

JAVA_HOME = C:\Program Files\Java\jdk1.7.0_79
JRE_HOME = C:\Users\316830207\jre7
PATH = C:\Users\316830207\AppData\Roaming\npm;C:\Users\316830207\AppData\Roaming\jdk1.7.0_79\bin
TMP = %USERPROFILE%\AppData\Local\Temp

If you notice my PATH variable for the user has npm path as well as jdk. 如果您注意到我的PATH变量为用户具有npm路径以及jdk。 The npm path was added so I could bower from the command line. 添加了npm路径,因此我可以从命令行开始使用。 That works! 这样可行! However the path for the JDK is never used. 但是,从未使用过JDK的路径。 No matter what when I type java -v I get 无论我输入java -v为何

The system cannot find the file C:\\ProgramData\\Oracle\\Java\\javapath\\java.exe 系统找不到文件C:\\ ProgramData \\ Oracle \\ Java \\ javapath \\ java.exe

Since the path variable contacts the only thing I can think of is it skips my JDK path or overwrites. 由于path变量联系我唯一想到的是它会跳过我的JDK路径或覆盖。 I have tried using command line using setx as I cannot use setx /M as I do not have admin access. 我已尝试使用命令行使用setx因为我无法使用setx /M因为我没有管理员权限。 I have searched for a few days now and the only conclusion is I am doing this wrong or security from my work is stopping me to overwrite JDKpath. 我已经搜索了几天,唯一的结论是我做错了,或者我工作的安全性阻止了我覆盖JDKpath。

So my question is am I setting the JDK path incorrectly? 所以我的问题是我是否正确设置了JDK路径? Is there a different way I can set it? 有其他设置方法吗? Why will it only use my environment path and not my user JDK path? 为什么只使用环境路径而不使用用户JDK路径?

JAVA_HOME contains the installation path of JAVA. JAVA_HOME包含JAVA的安装路径。

Set environment variable JAVA_HOME to installation path C:\\Program Files\\java\\ jdk-1_7_0_08 using following steps for windows user 1. Right Click on My Computer->Properties-> Advanced->Environment Variables ->User Variables -> New 2. Set JAVA_HOME to value C:\\Program Files\\java\\ jdk-1_7_0_08 使用以下步骤针对Windows用户1将环境变量JAVA_HOME设置为安装路径C:\\ Program Files \\ java \\ jdk-1_7_0_08。在“我的电脑”->“属性”->“高级”->“环境变量”->“用户变量”->“新建2”上单击鼠标右键。将JAVA_HOME设置为值C:\\ Program Files \\ java \\ jdk-1_7_0_08

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

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