Sent from ProtonMail, encrypted email based in Switzerland.
Sent with Proton Mail secure email.
------- Original Message ------- On Tuesday, September 26th, 2023 at 12:03 PM, Samuel Sieb samuel@sieb.net wrote:
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. _______________________________________________
Dear Sir,
Thank you for your help.
[olivares@fedora mptmp]$ rpm -qa | grep openjdk java-17-openjdk-headless-17.0.8.0.7-1.fc38.x86_64 java-latest-openjdk-headless-21.0.0.0.35-1.rolling.fc38.x86_64 java-latest-openjdk-21.0.0.0.35-1.rolling.fc38.x86_64 java-latest-openjdk-devel-21.0.0.0.35-1.rolling.fc38.x86_64 [olivares@fedora mptmp]$ javac Ulam.java --release 17 [olivares@fedora mptmp]$ java Ulam Enter any Number 23 Given Number is : 23 You are begining with number 23
70 35 106 53 160 80 40 20 10 5 16 8 4 2 1
Ulam count is 15 [olivares@fedora mptmp]$
Is there a better way to avoid doing this, ie removing java 17 and forcing 21 ? or vice versa to avoid this. I had not encountered this before in previous versions of Fedora it just worked! Now I have to specify. What would be the best thing to do? and make it work correctly.
Best Regards,
Antonio