简体   繁体   中英

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

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. I have followed many different tutorials and currently have my variables set up like this in my user PATH variable.

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. The npm path was added so I could bower from the command line. That works! However the path for the JDK is never used. No matter what when I type java -v I get

The system cannot find the file 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. I have tried using command line using setx as I cannot use setx /M as I do not have admin access. 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.

So my question is am I setting the JDK path incorrectly? Is there a different way I can set it? Why will it only use my environment path and not my user JDK path?

JAVA_HOME contains the installation path of 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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