Libgdx could not determine java version 11.0.1 - java

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

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).
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.
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.

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

Related

Ubuntu: Unable to start eclipse

I removed java-11 and installed jdk-1.8. Now when I try to start eclipse then its throwing the following error:
Being a beginner I searched and found some solutions but not worked for me
Ok. I'm going to make some assumptions based on some implications of what you've said here.
I assume that you had Java 11 installed, and you had installed Eclipse, and it was working.
You then, for some reason that I can't understand, decided to uninstall Java 11 and replace it with Java 8.
The error message is because when you had Java 11 installed and you installed Eclipse, Eclipse stored the path to the Java 11 distribution in the "eclipse.ini" file. Now that Java 11 is gone, it cannot start up.
The easiest way to fix this is to reinstall Java 11, and hopefully it will install into the same location as that error message shows it is looking for it.
Now, to address why you might have thought to replace Java 11 with Java 8. I'm guessing you're working on an application that requires Java 8 to compile and run. In this context, it's somewhat understandable that you would have done what you did, but it was the wrong thing to do.
Eclipse can run with one Java version, but build and run applications with a different Java version. In fact, I think it's generally a good idea to run Eclipse with the newest version of Java it can run (generally about a version short of the latest), but build your applications with the version of Java required for those applications.
So, you should have both Java 11 (or newer) AND Java 8 installed. Run Eclipse with Java 11, and build and run your applications with Java 8. In Eclipse, you have to register the Java 8 distribution in "Installed JREs" in Eclipse preferences, and also record that Java distribution in the "JavaSE-1.8" Execution Environment, in the preferences tab right below "Installed JREs". Set your application to require "JavaSE-1.8".

InteliJ Mac Catalina: Java 11 or newer is required to run the IDE

Hello yesterday I updated my IntelliJ ide to the latest version (2020.3.2). The problem is that it's not starting anymore. When I try to open it, I get this error message:
I have two JDKs, 8 and 12
It seems like InteliJ does some kind of lookup by alphabetical order because when I rename my jdk 8 to other name that goes after the "jdk-12..." it actually works
The problem is that have to rename the folders and then return the original names to make my projects work, is there a way to avoid this renaming? Thanks a lot
This IntelliJ IDEA version requires Java 11 to run.
You override default bundled JetBrains Runtime with Java 8.
The solution is to remove this override. It's either idea.jdk file in the configuration directory or an environment variable as described in this document:
~/Library/Application Support/JetBrains/IntelliJIdea2020.3/idea.jdk
Note that JDK used to run IntelliJ IDEA itself is not related to the JDK that you are using to build and run your own projects. These two can be different.
I bumped into this issue with my PyCharm. In that case, pycharm.jdk was the one we need to remove.
~/Library/Application Support/JetBrains/PyCharm2020.3$ mv pycharm.jdk /tmp
Hope it helps someone came here by google.

How to deal with 'Incompatible Java Versions running 0' in Eclipse Window Builder?

I have Eclipse installed with WindowsBuilder, and it has worked fine in the past in showing the design tab of JFrame.
I just installed Intellj, and installed a JDK in addition to my current SE-9 JVM. My eclipse program is still functional , but is showing the following when I open WindowsBuilder design:
Incompatible Java versions: Eclipse is running under 0, but this Java project has a
9 Java compliance level, so WindowBuilder will not be able to load classes from this
project. Use a lower level of Java for the project, or run Eclipse
using a newer Java version
There must be something to the zero, rather than 1.8 or 9.
Other StackExchange answers suggest that I downgrade my Java version, but when I went to project/properties/java compiler, it did not work.
My java compiler is linked to SE-9, so I am unsure why this new error is occurring. Maybe it is due to installing the JDK as well?
It's a known bug with the detection of Java version strings in Window Builder. Historically, the parsing of version strings was implemented to not check for the major version part at index position 0, e.g 9.0 or 10.0, but at index 2, namely 1.6, 1.7,...
Sadly, as of today, in the bug report 517291 we find this:
Patches welcome, we currently do not have active WB developers.
so somebody has to contribute a fix for this undesired behaviour that causes you pain.
So for now, you have to stay with Java versions less or equal to 1.8 if you want to use Window Builder in Eclipse. For reference, see this answer by greg-449 or this answer on this topic.
Hope this helps (for now).

Where is Java 8 hiding?

This is probably a cliché question that was repeated a trillion times. But I'm asking here because I became fully and totally desperate and I need some pointers to continue.
I'm learning how to program games using LibGDX. I'm using this tutorial. The problem is the classic error:
Errors occurred during the build. Errors running builder 'Android
Package Builder' on project 'HelloWorld-android'.
com/android/dx/command/dexer/Main : Unsupported major.minor version
52.0
I understand that this error means that some how, Eclipse is using Java 8 to compile, and an earlier version of Java to run, which is creating this incompatibility. But guess what? I don't even have Java 8 on my computer! I have:
Android SDK
Java 7u79
Eclipse Luna
LibGDX, that generates the project for me.
I don't understand why this is happening, so please assist and tell me why this would happen. Following are screenshots of Eclipse showing that everything is 1.7.
And yet I keep getting this error on right click -> Debug As -> Android Application:
What did I miss? Where is Java 52 coming from?
I would like to point out that the Desktop version of the game runs with not a single problem.
Thank you for any efforts. Please don't hesitate in asking for more information.
It's not your code that requires Java 8.
"Error running builder 'Android Package Builder'
means something in the android build tools, some of which are also written in Java, require Java 8 to run.
You'll have to install Java 8 so that it runs Eclipse & gradle. Java 8 can compile for Java 7, so you don't have to change the project to Java 8 (which would also mean the app would only work with Android N and above).
The safest bet is to remove all Java < 8 versions from your computer, that way you can't accidentally run with an older version. You'll have to update the "installed JREs", set the default (& especially the one in the gradle screen) to your Java 8 install, but keep the project's "Compiler compliance level" at 1.7.

MoSync: Java Started but Returned Exit Code 13

I want to start making android apps using MoSync but when I tried to run MoSync for the first time, confronted with this error:
http://s3.picofile.com/file/8197460276/Capture.PNG
In addition, I have ran eclipse and android studio without java errors and tried lots of solutions mentioned in other posts. I will appreciate it whether you can give me solutions to start mosync without errors.
I could finally solve the problem acting like this:
1. First, I uninstalled MoSync v2.7 (which was installed).
2. Then, I downloaded MoSync v4.0 Alpha and installed it.
3. After that I uninstalled ALL the Java Kits and tools from Control Panel.
4. Then I installed Java(TM) Development Kit version 6 update 45 i568.
5. Finally, I acted like what MoSync said and copied jre folder into MoSync folder.
Finish.
It amazingly worked for me!

Categories