Quick Index
Troubleshooting Table


ProblemRemedy
When compiling, this error is shown: "javac is not recognized"See VerifyPath...
When you run the "java" command you get "UnsupportedClassVersionError ... has been compiled by a more recent version ..."See UnsupportedClassVersionError


UnsupportedClassVersionError


Problem

When running your java program e.g. when running the
 "java Foo"
command, if you are getting errors something like these:

UnsupportedClassVersionError
has been compiled by a more recent version of the Java Runtime
(this file version 57.0), this version of the Java Runtime only recognizes
class file version up to 54.0


Fixing

This indicates that we are using a different version of "java.exe" (run) vs "javac.exe" (compile).

Because both "java.exe" and "javac.exe" are in the same directory ("...\java\bin"), this usually can be resolved by fixing the system path. See verify path.

Then check and ensure that the "%JAVA_HOME%\bin" line is at the top of the path variable as described here....

Diagnostic Tools Cheat Sheet


CommandExampleNotes
javac -version
>javac -version
javac 11.0.2
The configured jdk version
java -version
>java -version
java version '11.0.2' 2019-01-15 LTS
The version here should match that with the "javac -version" output
echo %JAVA_HOME%
>echo %JAVA_HOME%
C:\Program Files\Java\jdk-11.0.2
Full path to your installed jdk
echo %path%
>echo %path%
C:\Program Files\Java\jdk-11.0.2\bin; etc...
The output should start out with the full path to your jdk plus '\bin'


NOTES

Windows-Only Diagnostic Tools


CommandExampleNotes
wmic os get osarchitecture
>wmic os get osarchitecture
OSArchitecture
64-bit
64-bit indicates system is 64-bit, otherwise system is 32-bit
echo %PROCESSOR_ARCHITECTURE%
>echo %PROCESSOR_ARCHITECTURE%
AMD64
'64' indicates system is 64-bit, otherwise system is 32-bit