0

So, I'm trying to run a jar file which was created using Gradle through the command line of Intellij (I want to later use a bat file to open it, that's why I don't open it through Intellij directly, tho it works if I do it directly). The error I get when trying to run the command is this one:

D:\User\<Name>\AppData\Local\JetBrains\Projects\TribusSpring\build\libs>java -jar TribusSpring-0.0.1-SNAPSHOT.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: 
com/tribus/tribusspring/TribusSpringApplication 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 55.0

I looked around and saw, that the reason for that is, that the project was built in java 17, and apparently I try to run it with java 11? I don't have java 11 on my pc and installed jre 17 on my pc a few hours ago. Furthermore, I also went to the Gradle settings and those show, that java 17 is used, same for the project settings. What exactly is causing this?

  • 1
    Make sure your `JAVA_HOME` environment variable is pointing to the v17 and not v11. You might need to close your command/console window and open it again (so it picks up the newer variable value. – blurfus Feb 02 '23 at 21:59

0 Answers0