How to Make Your Computer Change Java Path

可紊 提交于 2021-02-11 12:59:07

问题


So a while back I installed some .jar files for game mods, which seems to have installed the 1.8 JRE on my computer. Now, I installed JDK 14, however, my computer still thinks that my Java version is 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.

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. How do I get my computer to run Java from JDK 14?

*Apologies if this doesn't make much sense, I still don't know much about how computers work.


回答1:


I'm assuming you are using Windows based on Program Files (x86) folder. Let say it is Windows 10.

Go to environment variable, system variables section.

  1. change CLASS value to ...\java14\bin
  2. change classpath value to ...\java14\lib\ *.jar
  3. change JAVA_HOME value to ...\java14
  4. change PATH value to ...\java14\bin (be sure to move this up to the top)

Substitute the name of your jdk folder to java14 Now it should perform as expected. javac will be version 14, java will be version 14 too.



来源:https://stackoverflow.com/questions/63910493/how-to-make-your-computer-change-java-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!