简体   繁体   中英

JDK/JRE installation for Windows

I am attempting to install JDK 13 with the accompanying JRE.

I set these environment variables:

JAVA_HOME to C:\\Program Files\\Java\\jdk-13.0.2
JRE_HOME to JAVA_HOME\\bin

as per online instructions.

But when I try:

java Greetings

I get an error message that reads like: "JRE incompatible with with JDK 13 compiler".

java -version says "java version 1.8.0_241"

The Java Control Panel lists:

Product: 1.8.0_241 Path: C:\Program Files\Java\jre1.8.0_241\bin\javaw.exe
Product: 13.0.2    Path: C:\Program Files\Java\jdk-13.0.2\bin\javaw.exe

I can delete the entry for 13.0.2 but not the entry for 1.8.0_241

What am I missing?

The JAVA_HOME variable is used by many programs (eg Eclipse IDE and the Maven build processor) to find the Java Runtime.

However, the CMD shell searches executables by the PATH variable. You need to add the path to java.exe to the PATH variable as well. Also ensure that you do not have multiple Java versions in the PATH because the first one will be executed.

Please note that all environment variables can be configued for all users system-wide and also for each account personally. This causes confusion sometimes.

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