Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Gradle comply about unsupported Java Version
Gradle comply about unsupported Java Version [message #1868163] Sat, 13 July 2024 06:57 Go to next message
A B is currently offline A BFriend
Messages: 2
Registered: July 2024
Junior Member
I created a simple Java Application in Eclipse to test building and deployment. I set the project target Java Version to 17. The application runs fine within the IDE by selecting "run as java application".

Now I want to build a runnable .jar package.

Therefore I created a "run configuration" in "gradle task". Is this the correct way?

If I run this gradle task I get:
The supplied phased action failed with an exception.
Could not open cp_init generic class cache for initialization script 'C:\Users\***\eclipse-workspace\.metadata\.plugins\org.eclipse.buildship.core\init.d\eclipsePlugin.gradle' (C:\Users\***\.gradle\caches\8.1.1\scripts\2to4is5l87jn9v7vrcgka57e).
BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 66

This message makes no sense since I have no JRE 22 (Version 66) installed.
The one and only listed and to eclipse known JRE in the "window - preferences - Java - Installed Java JREs" table is my installed JRE 17.
In all the bunch of settings tables and files in eclipse I cannot find a setting which tells gradle "use JRE 22".

How do I have to configure gradle to build a runnable .jar package?
Re: Gradle comply about unsupported Java Version [message #1868166 is a reply to message #1868163] Sat, 13 July 2024 10:14 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33263
Registered: July 2009
Senior Member
It's probably better to ask here:

https://discuss.gradle.org/c/help-discuss/buildship/20


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Gradle comply about unsupported Java Version [message #1868172 is a reply to message #1868166] Sat, 13 July 2024 22:28 Go to previous messageGo to next message
A B is currently offline A BFriend
Messages: 2
Registered: July 2024
Junior Member
Digging deeper and deeper shows a wierd explicitly JRE bounding of Eclipse for Gradle:

From the Gradle Log:
Working Directory: C:\Users\***\eclipse-workspace\testswing
Gradle user home: C:\Users\***\.gradle
Gradle Distribution: Specific Gradle version 7.3.3
Gradle Version: 7.3.3
Java Home: C:\Users\***\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_22.0.1.v20240426-1149\jre
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: true
Offline Mode Enabled: false
Gradle Tasks: <run default tasks>

Even if Eclipse is set to use JRE 17 and the compiler compliance is set to Java 17 eclipse still runs on the latest version of Java (which is 22).
according to the Gradle-Java-Version-Matrix for Java 22 the Gradle Version 8.8 or 8.9 must be used. The Gradle setting "Gradle Wrapper" seems not to do so, which leads to the message "Unsupported class file major version 66".
Forcing Eclipse to use Gradle 8.9 solves the issue...at least as long Eclipse not move on to a never JRE.

Re: Gradle comply about unsupported Java Version [message #1868175 is a reply to message #1868172] Sun, 14 July 2024 06:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33263
Registered: July 2009
Senior Member
For what it's worth, wildwebdeveloper was adding JustJ JREs to its update site, was adding that update site to every installation in which it was installed, and then updates could/would install that version of JustJ. That was not intended:

https://github.com/eclipse-wildwebdeveloper/wildwebdeveloper/issues/938


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Where's the marketplace?
Next Topic:New topic will not post
Goto Forum:
  


Current Time: Thu Dec 12 07:37:33 GMT 2024

Powered by FUDForum. Page generated in 0.08139 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top