Jump to content
Magno

[SOLVED] Java unsupported class version error with Delphi 12

Recommended Posts

Hello!

I have installed D12 Community version, after struggling with Android SDK, at the end now I have installed both 33 and 34. I also have D11 installed but as nothing was working before I remove the SDK from D11 as my intention is move to D12. With that said, after installed everything I opened a sample to give a test and something is off. I have downloaded the JDK 21 (Eclipse Adoptium [C:\Program Files\Eclipse Adoptium\jdk-21.0.4.7-hotspot] but anyways:

 

java.lang.UnsupportedClassVersionError: com/embarcadero/dexer/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I can understand that my java runtime is using an older version and to add more confusion I also will have a version 17 on C:\Program Files\Microsoft\jdk-17.0.12.7-hotspot plus a JDK for C:\Program Files\Java...

 

Now, how can I fix that? Of course I would like to have only one version of the SDK.

 

SOLVED: I uninstalled every Java JDK installation and had sure to have only one, fixed some system environment variables, reconfigured the SDK path and done

Edited by Magno

Share this post


Link to post

To those that have installed Delphi12.3 you may come up against this same error.

 

To fix the error down load the latest JDK.  And then you will need to update the JAVA items in the SDK manager.

image.thumb.png.d7b143f274996696f1d3eff2ff222483.png

  • Thanks 1

Share this post


Link to post

Hi @Rick Howitt

 

Why do you think this error will appear for Delphi 12.3 ?

 

The supported SDK is 35. NDK, SDK and JDK are installed for that. And if you want to change things (install packages, ...) you have now the Android Manager in GetIt.

 

 

The only thing to do for existing projects is to refresh Android libraries list from the contextual menu in the project manager.

 

If you forced the SDK in the Android manifest, use the default one.

 

Share this post


Link to post

This error appeared since 12.3,by default it doesnt work, refreshing libraries also didnt fixed the issue! The new Android Manager also dont work @Patrick PREMARTIN

image.thumb.png.37231495c6dc33c510b12a4ea5945981.png

 

The solution from @Rick Howitt worked, thank you!

 

 


 

Share this post


Link to post
3 minutes ago, dtpfl said:

This error appeared since 12.3,by default it doesnt work, refreshing libraries also didnt fixed the issue! The new Android Manager also dont work

Yes, this is tue, after updating with that tool the USB driver, it (the tool) doesn't work anymore ... same issue.

 

But of course you can use the command line to install other sdk platforms.

 

On 8/4/2024 at 3:23 PM, Magno said:

java.lang.UnsupportedClassVersionError: com/embarcadero/dexer/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

This is because when you used something from Embarcadero (but if try to update Android platforms was the same) your Windows environment was setting for Java version less the 17. JDK, JRE,SDK or like you want to call them MUST BE version 17 or  upper to managed class file version 61.

 

In this case the error seems to say you had active Java SDK version 8.

 

I normaly used to set this two environment "variables" and I never had problem with JAVA or Android SDK:

 

Quote

JAVA_EXE=C:\Program Files\Common Files\Oracle\Java\javapath\java.exe

SKIP_JDK_VERSION_CHECK=1

Of course with the correct personal path and be sure the you have Java version upper or equal to 17 (by now, in the future will see).

  • Like 2

Share this post


Link to post

Good to know you find a solution.

 

946786576_Capturedcran2025-03-1416_53_18.thumb.png.ccaea6075668dfcf13b3a0d45af12df3.png

 

I've just installed the Android SDK manager GUI from GetIt and it worked fine.

 

I don't have Android Studio or VS Code in my VMs. Do you have any of them or an other development tool ?

 

Share this post


Link to post
26 minutes ago, Patrick PREMARTIN said:

I've just installed the Android SDK manager GUI from GetIt and it worked fine.

 

I don't have Android Studio or VS Code in my VMs. Do you have any of them or an other development tool ?

I work with real machine not VM, and I don't have Android Studio installed.

That tool works and show me the same window, but after install the USB driver (in Extras may be) it stopped works.

 

I use a personal path for Catalog Repo (no UTF chars) ...

 

But it's not a real problem for me. You can do the same with other means.

 

EDIT:

UPDATE: I used the old "Android SDK Tools" and delete the USB Driver. Now the new Embacadero tool is working again ... 🙂Install again the USB driver ... the Embarcadero tool seems to still  works ... (with some graphic glitch about old Anroid tools).

 

image.thumb.png.5aca14c86b4dd253aca1ab5234d2a7cc.png

 

Edited by DelphiUdIT

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×