0

Trying to run

java -Xmx4G -Xms4G -jar launch.jar

but that leads to error

Exception in thread "main" java.lang.UnsupportedClassVersionError: launch.jar 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
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)

I found this topic but solution doesn't change anything.

Using macOS 13.4 (22F66); Java version is 1.8.0_371, tried to install Java 17 with Homebrew brew install openjdk@17

Do you have any answer to this, ideally by using only command lines as in 1 ?

21
  • Relaunch system do not change anything. Commented Aug 17, 2023 at 15:43
  • The latest OpenJDK is 20. Why would you go with such an old version of Java when the error message specifically states "it was compiled with a more recent version of Java"? Commented Aug 17, 2023 at 16:00
  • Thanks, trying with brew install openjdk@20. Commented Aug 17, 2023 at 16:04
  • Same error in output. Do you know if there is a way to force shell to execute with this version of openjdk ? Commented Aug 17, 2023 at 16:09
  • 1
    Wait...did you literally use foobar.jar? That's a placeholder for whatever jar file you actually want to run. Commented Aug 17, 2023 at 17:26

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.