简体   繁体   English

如何让您的计算机更改 Java 路径

[英]How to Make Your Computer Change Java Path

So a while back I installed some .jar files for game mods, which seems to have installed the 1.8 JRE on my computer.所以不久前我为游戏模组安装了一些 .jar 文件,它似乎在我的电脑上安装了 1.8 JRE。 Now, I installed JDK 14, however, my computer still thinks that my Java version is 1.8.现在,我安装了 JDK 14,但是,我的计算机仍然认为我的 Java 版本是 1.8。 I have two Java folders on my computer - one in Program Files with the JDK, and one in Program Files (x86) with the old JRE.我的计算机上有两个 Java 文件夹——一个在带有 JDK 的 Program Files 中,另一个在带有旧 JRE 的 Program Files (x86) 中。

I set the JAVA_HOME environment variable to the directory of the JDK but when I type java -version in my Command Prompt it still says 1.8.我将 JAVA_HOME 环境变量设置为 JDK 的目录,但是当我在命令提示符中键入java -version ,它仍然显示 1.8。 How do I get my computer to run Java from JDK 14?如何让我的计算机从 JDK 14 运行 Java?

*Apologies if this doesn't make much sense, I still don't know much about how computers work. *抱歉,如果这没有多大意义,我仍然不太了解计算机的工作原理。

I'm assuming you are using Windows based on Program Files (x86) folder.我假设您使用的是基于 Program Files (x86) 文件夹的 Windows。 Let say it is Windows 10.假设它是 Windows 10。

Go to environment variable, system variables section.转到环境变量,系统变量部分。

  1. change CLASS value to ...\\java14\\binCLASS值更改为 ...\\java14\\bin
  2. change classpath value to ...\\java14\\lib\\ *.jarclasspath值更改为 ...\\java14\\lib\\ *.jar
  3. change JAVA_HOME value to ...\\java14JAVA_HOME值更改为 ...\\java14
  4. change PATH value to ...\\java14\\bin (be sure to move this up to the top)PATH值更改为 ...\\java14\\bin(务必将其移至顶部)

Substitute the name of your jdk folder to java14 Now it should perform as expected.jdk文件夹的名称替换为java14现在它应该按预期执行。 javac will be version 14, java will be version 14 too. javac将是 14 版, java也将是 14 版。

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

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