On 9/26/23 06:03, olivares33561 via users wrote:
>> [olivares@fedora mptmp]$ uname -a
>> Linux fedora 6.4.15-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep 7 00:25:01 UTC
2023 x86_64 GNU/Linux
>> [olivares@fedora mptmp]$ javac Area_Triangle_Determinants.java
>> [olivares@fedora mptmp]$ java Area_Triangle_Determinants
>> Error: LinkageError occurred while loading main class Area_Triangle_Determinants
>> java.lang.UnsupportedClassVersionError: Area_Triangle_Determinants has been
compiled by a more recent version of the Java Runtime (class file version 65.0), this
version of the Java Runtime only recognizes class file versions up to 61.0
>
>
> Looks like the compiler you're running is newer than the runtime you're
> using.
> What do "javac --version" and "java --version" show?
> What does "rpm -qa | grep openjdk" show?
> _______________________________________________
[olivares@fedora mptmp]$ javac --version
javac 21
[olivares@fedora mptmp]$ java --version
openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment (Red_Hat-17.0.8.0.7-1.fc38) (build 17.0.8+7)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.8.0.7-1.fc38) (build 17.0.8+7, mixed mode,
sharing)
So there's the problem. You're compiling with 21, but running it with
17. You could try adding "--release 17" to the javac command when you
compile or switch the default java to 21 using the alternatives command.
Or directly specify the 17 compiler when you compile.