An exception occurred while executing the Java class. Unsupported major.minor version 68.0

I am testing graalvm espresso.
$ java --version
Espresso 64-Bit VM Oracle GraalVM 21.0.2+13.1 (build 21-espresso-24.2.0, mixed mode)
$ java --version
Espresso 64-Bit VM Oracle GraalVM 21.0.2+13.1 (build 21-espresso-24.2.0, mixed mode)
I created a vanilla java program, which can be compiled and ran without a problem. However, when attempting to manage the project using maven (v.3.9.11), mvn throws An exception occurred while executing the Java class. Unsupported major.minor version 68.0. I know its version mismatched error. So I add related fields with version 24 such as maven.compiler.source, maven.compiler.target, source, target to pom.xml as below. But the problem remains. What's the correct fields or version value to specify for pinning the jdk source and target version? Or anything that I also need to configure or miss? Thanks.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
...
<properties>
<java.version>24</java.version>
<maven.compiler.source>24</maven.compiler.source>
<maven.compiler.target>24</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.graalvm.espresso</groupId>
<artifactId>continuations</artifactId>
<version>24.2.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<source>24</source>
<target>24</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
...
<properties>
<java.version>24</java.version>
<maven.compiler.source>24</maven.compiler.source>
<maven.compiler.target>24</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.graalvm.espresso</groupId>
<artifactId>continuations</artifactId>
<version>24.2.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<source>24</source>
<target>24</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
11 Replies
JavaBot
JavaBot•2w ago
āŒ› This post has been reserved for your question.
Hey @everymen! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Madjosz
Madjosz•2w ago
The versioning scheme more looks like the latest supported JDK version of your GraalVM runtime is 21. Yep, that's it. While GraalVM website says it would be "GraalVM for JDK 24 (Latest)" when I try to run a file compiled with JDK 22 I get a LinkageError with UnsupportedClassVersionError.
dan1st
dan1st•2w ago
Their runtime is espresso and not GraalVM directly espresso is a different JVM but idk whether espresso for JDK 24 is supposed to be supported with GraalVM for JDK 21 I think that's because you are compiling it with JDK 21 (GraalVM) and you would only use espresso for running your application but not compiling (idk whether that's supported). Nothing in your pom.xml specifies that you are actually using espresso for anything other than a dependency basically but yes, trying to use GraalVM for JDK 24 is probably still a good idea
Madjosz
Madjosz•2w ago
I downloaded from here so I tested with Espresso 24: https://www.graalvm.org/latest/reference-manual/espresso/
Espresso …
GraalVM is an advanced JDK with ahead-of-time Native Image compilation.
dan1st
dan1st•2w ago
So? this is espresso for JDK 24 I think even though espresso itself is running on JDK 21 but yes I generally wouldn't run espresso for applications using a Java version not designated as LTS by Oracle
Madjosz
Madjosz•2w ago
For me it even explicitly prints
$ espresso24 -version
java version "21.0.2" 2024-01-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-LTS-jvmci-23.1-b33)
Espresso 64-Bit VM Oracle GraalVM 21.0.2+13.1 (build 21-espresso-24.2.0, mixed mode)
$ espresso24 -version
java version "21.0.2" 2024-01-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.2+13.1 (build 21.0.2+13-LTS-jvmci-23.1-b33)
Espresso 64-Bit VM Oracle GraalVM 21.0.2+13.1 (build 21-espresso-24.2.0, mixed mode)
So idk where the 24 comes into play actually.
dan1st
dan1st•2w ago
seems like that one espresso version is espresso for JDK 24 but actually running on JDK 24
JavaBot
JavaBot•2w ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
everymen
everymenOP•2w ago
Thanks for the input. I will try if there exists v24 version, not v21. Thanks again for the advice!
JavaBot
JavaBot•2w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
JavaBot
JavaBot•2w ago
Post Closed
This post has been closed by <@1225316541067825183>.

Did you find this page helpful?