I am using JDK 14 on Netbeans on Windows 10. Everything works fine in the IDE environment. However, when I try to compile and run a source file from the command prompt, I get the java.lang.UnsupportedClassVersionError.
JAVA_HOME=c:\java\jdk14
The PATH and CLASSPATH in the system variables contain JAVA_HOME\bin, JAVA_HOME\lib.
If I issue java -version from the command prompt, in the JAVA_HOME directory, I get the following:
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) Client VM (build 25.251-b08, mixed mode)
If I issue java -version from the JAVA_HOME\bin directory I get a different message listed below:
java version "14.0.1" 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
I am not sure why? Please offer any advice. Thanks