Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Libgdx could not determine java version 11.0.1

I tried everything I installed every possible Java file a million times I installed the newest gradle version but it continues to show this error. I'm on Mac. Please help thanks

like image 911
Simsat Avatar asked Dec 03 '18 19:12

Simsat


People also ask

What version of Java does libGDX use?

Java 7. libGDX now requires Java 7. The only exception is the LWJGL 3 subproject, which requires Java 8. See #5839 for more information.

Could not determine Java version from 11.0 2 Intellij?

To Solve Could not determine java version from '11.0. 2' Error You need to upgrade wrapper using this command and just make sure Just Use gradle and not gradlew . gradle wrapper –gradle-version 5.1.


2 Answers

I am strongly recommend to use Java version not greater than 8. It is many incompatibility issues I faced just on 9 version of JDK in Android Dev environment.

Uninstall all java you have, use this article, because it is not as such easy without knowledge: https://www.java.com/en/download/help/mac_uninstall_java.xml

After download the 8th version from here: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

I did same some time ago and all problems left

like image 33
AntNat Avatar answered Oct 16 '22 16:10

AntNat


IF you do not want to develop for Android Java 11 works fine libgdx.

You have to change some things before everything builds and runs.
Here's what I did to get my project working.
My context Mac OSX 10.14 and openJDK 11.0.2, new project, Desktop launcher and a bunch of Extensions (not important).

  1. The error you get about not being able to find java 11.0.x comes from gradle. Java 11 is only supported since gradle 5. In order to use gradle 5 instead of 4.6 the generated project is configured with, go to <project-dir>/gradle/wrapper/gradle-wrapper.properties and change distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip into distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip.

That resolves the java 11 error just to confront you with a new error Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.

  1. To get rid of that, open <project-dir>/desktop/build.gradle and change line 27 (might be different for you)
    from files(sourceSets.main.output.classesDir) into
    from files(sourceSets.main.output.classesDirs)

    thats classesDir into classesDirs

This should resolve all build errors and you're good to go.

like image 139
Rene R. Avatar answered Oct 16 '22 15:10

Rene R.