简体   繁体   English

在没有管理员权限的情况下更改 Windows 10 中的 Java_Home 路径

[英]Change Java_Home Path in windows 10 without admin rights

I have a windows 10 laptop and I donot have admin rights.我有一台Windows 10笔记本电脑,但我没有管理员权限。 But there is already jdk 11 installed in my laptop with JAVA_HOME set in system variables.但是我的笔记本电脑中已经安装了 jdk 11,并在系统变量中设置了JAVA_HOME So one of my project does not compile with java 11 and I needed to install jdk 8 and I followed this instructions and installed it.所以我的一个项目不能用 java 11 编译,我需要安装 jdk 8,我按照这个说明安装了它。

I have set the JAVA_HOME again in the user variables.我在用户变量中再次设置了JAVA_HOME But when I tried to see the version using java --version I could only see the jdk 11 that is set in system variables and I cannot see the jdk 8 that I installed in the C:/Users directory.但是,当我尝试使用java --version查看版本时,我只能看到系统变量中设置的jdk 11 ,而看不到我安装在C:/Users目录中的jdk 8 So how can I set/change the JAVA_HOME for my maven project to build in git bash and run the spring boot app.那么如何为我的 Maven 项目设置/更改JAVA_HOME以在 git bash 中构建并运行 spring boot 应用程序。

EDIT: note: I have also added the %JAVA_HOME%\\bin to User variables Path.编辑:注意:我还将 %JAVA_HOME%\\bin 添加到用户变量路径。

As suggested, you can add to the PATH the %JAVA_HOME%\\bin https://maven.apache.org/install.html按照建议,您可以将%JAVA_HOME%\\bin https://maven.apache.org/install.html添加到 PATH

Then using the ff.然后使用ff。 command, verify what JDK version your maven using命令,验证您的 Maven 使用的 JDK 版本

mvn -v

you should see something like this你应该看到这样的

输出截图

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

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