I have a project with 3 modules. I am running them with Intellij. Everything worked fine until project was upgraded to java 17, I ran following commands in terminal:
sdk install java 17.0.3-tem
sdk use java 17.0.3-tem
In Intellij preferences Compiler -> Java Compiler -> Project bytcode version is set to 17 as well as all per module bytecode target versions.
I have tried to use both javac and eclipse compiler, also I have set the Gradle Jvm to temurin-17 in Intellij Build Tools -> Gradle, but I still get an error:
Error: LinkageError occurred while loading main class glow.MainKt
java.lang.UnsupportedClassVersionError: myproject/MainKt 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 58.0
What else do I need to do in order to get rid of this error?
Related
I am getting the following error message:
error message
For some reason IntelliJ compiles plugin JAR files with JDK 11 not 8.
I have the following configuration in Project Structure:
IntelliJ Project Structure view
Gradle JVM:
Gradle JVM view
Java Compiler:
Java compiler view
Also tried to change Boot runtime version, but in case I am using an old one IntelliJ won't open:
Currently selected version of JBR version
JAVA_HOME is referencing to JDK 8:
Windows JAVA_HOME variable value
Right now I don't have any ideas what to do. Any suggestions?
IntelliJ version: 2022.3.1
Gradle Wrapper version: 3.0
JDK version: 1.8
A problem occurred evaluating root project 'xxx'.
> Could not create task ':prepareRelease'.
> Could not create task of type 'GitReleaseTask'.
> Could not generate a decorated class for type GitReleaseTask.
> org/eclipse/jgit/lib/ObjectId has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
GitReleaseTask.groovy is groovy task which use org.eclipse.jgit library from gradle.
I get the above exception while am building my project. I have also noticed jgit v5.13 in classpath of my project currently. The build was successful till few days back and all of the sudden it fails. My guess is that jgit v5.13 is built using advanced versions of Java and we are using Java8 to build our project.
Can someone help?
I'm trying to setup libgdx for a desktop game and when I try to generate the project I have this error and the build fails.
I've the latest versions of Java(13.0.2) and Gradle(6.6), both set as environment variables in the path. Can somebody help me?
The error looks like this:
Could not compile settings file 'C:\Users\noemi\Desktop\Test\settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 57
java.lang.IllegalArgumentException: Unsupported class file major version 57
This is not a LibGDX issue. Gradle 5 is incompatible with Java 13. You either need to update Gradle (the wrapped version in your project) to Gradle 6 or later, or you need to use a lower version of the JRE.
To update the wrapped gradle, go to gradle/wrapper/gradle-wrapper-properties in your project and update the version number. I'm using 6.1.1.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
If you have an older LibGDX project, you might have to modify the build.gradle file in the android module to be compatible with Gradle 6. You can copy-paste to replace the copyAndroidNatives task with the one here.
startup failed:
General error during semantic analysis: Unsupported class file major version 61
how to fix this react native issues
JAVA JDK 17
Go to the android/ directory of your react-native project
Create a file called local.properties with this line:
sdk.dir=C:\Android\sdk
GOTO
android\gradle\wrapper\gradle-wrapper.properties
CHANGE
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip
TO
distributionUrl=https://services.gradle.org/distributions/gradle-7.3-all.zip
GOTO
android\gradle.properties
add this line
org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
This problem occurred when I run my old Flutter project that I coded 2 years ago. I think with Android project will also fix in the same way. I'm use MacOS and Android Studio Bumblebee.
First, need to move to the android folder and check gradle version:
cd android
./gradlew --version
It show Gradle version 6.7.1 and you need attention to the JVM line, and my JDK version is 15.0.2. It is too new for this project. So you must to downgrading from open jdk version to old version or upgrade Gradle version in gradle/wrapper/gradle-wrapper.properties to new version.
If you downgrade JDK version, you can download from this. In my case, I downgraded from Java SE 15 to Java SE 11.
After I open Android of Flutter project
Go to Preferences->Build, Execution, Deployment → Build Tools → Gradle → and choose JDK version 11.
Go to Build -> Clean Project -> Rebuild Project.
Go to Terminal run java --version, if it still show JE version 15 then You must set JAVA_HOME before.
You only need to add the following to your .bash_profile or .zshrc
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.15.jdk/Contents/Home
Save and go to android folder and run again
./gradlew --version
It will show JDK version 11 correct.
Finally, run flutter run.
If you're using eclipse, go to
Eclipse > Preferences > Gradle
Update Java home to point to Java home location
I have downgraded gradle file thats why this error happens so finally I have to change Gradle wrapper file From
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
Check gradle version and bundle version using the following link
Link https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
If you want to upgrade android/gradle/build.gradle change dependencies classpath 'com.android.tools.build:gradle:[latest version]'
I'm learning how to use Gradle to build projects in IntelliJ. I want to build a project involving OpenJFX. However, I encounter this error.
java.lang.UnsupportedClassVersionError: org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
> org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
From what I can figure out, Gradle is using Java 8 to run a Java 11 plugin. However, I put this in gradle.properties:
org.gradle.java.home=/C:/Users/<my user>/.jdks/openjdk-14.0.1
The reason it's in .jdks is because IntelliJ downloaded it earlier. The thing is, I told Gradle to use Java 14, yet it gives me an error as if it's being run by Java 8. What's wrong here?
According to the docs org.gradle.java.home property…
…specifies the Java home for the Gradle build process. The value can be set to either a jdk or jre location, however, depending on what your build does, using a JDK is safer. A reasonable default is derived from your environment (JAVA_HOME or the path to java) if the setting is unspecified. This does not affect the version of Java used to launch the Gradle client VM
So, this value is only used for build process (like compiling or running app or tests). Gradle spins up a child process for that, so the VM that performs tasks and the VM that runs the build script may not be the same.
It looks like you're using a Gradle plugin compiled with Java 11 (55.0), but your Gradle VM is Java 8 (52.0), so it cannot load and use plugin's class. You must use Java 11+ for Gradle VM itself.
Try running you build like JAVA_HOME=C:/Users/<my user>/.jdks/openjdk-14.0.1 gradlew.bat clean run.
I found out how to change Gradle's JVM. In IntelliJ, go to Preferences (Ctrl-Alt-S); then Build, Execution, Deployment; then Build Tools > Gradle. There's a little menu that lets you choose between the JVMs it recognizes.
Getting this error when trying to run gradle build.
org/openjfx/gradle/JavaFXPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Now there's tonnes of similiar questions on StackOverFlow about this, but every suggestion doesn't work that I've found:
My Project/Module language level are the same (11)
The bytecode version of the project is also 11
There is only OpenJDK11 installation I'm using.
Path and JAVA_HOME variables point to the above installation.
There are no other lingering java/oracle enviromental variables.
Running java -version results in:
I don't understand what's happening. I can't see how it's using JRE 8 when I only have JDK 11. I'm at a total loss here.
It may be that the Gradle JVM is still set incorrectly. If you are using IntelliJ, you can change this by going to File > Settings > Build, Execution, Deployment > Build Tools > Gradle and change Gradle JVM to 11 (or to the Project JDK).