LibGDX JDK Version - java

I've wanted to create a game with libGDX recently. So I installed Oracle's JDK 12.0.1, downloaded libGDX's gradle-based project creation tool, and just tried to create a project at first. Hit generate button, it started to install gradle-4.6 version and failed to build cause gradle-4.6 does not support java 12.0.1. So my question is, how can I change the preferred gradle version and will the change solve my issue? Or do I have to work with JDK 8 for example because of Android.
Thx in advance.

Refering to https://libgdx.badlogicgames.com/documentation/gettingstarted/Setting%20Up.html, libGDX should support java 12 (if you don't want to export on Android, if so I would rather consider working with the JDK 8).
To remove the problem with gradle you just have to change inside the file located in project/gradle/wrapper/gradle-wrapper.properties, and change the distribution to distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-all.zip

Related

NetBeans: "Failed to automatically set-up JavaFX Platform"

I have been troubleshooting this error for the past few days - and have hit a brick wall. I am running NetBeans v11.3, and Ubuntu Bionic (v18.04.4).
I have installed Java versions 8 and 11 (openjdk) along with source code.
I have also installed javaFx versions 8 and 11 with source code.
I have even gone to "Tools -> Java Platform Manager" and ensured that v8 and v11 of Java are properly installed along with the appropriate "Platform Sources".
But I still get the error mentioned when I try to create a new JavaFX project.
Any help would be very much appreciated.NetBeans JavaFX project create error
I have never tried to use JavaFX on openJDK, try out with Oracle JDK, as far as I know this is the best choice for using JavaFX, also try to edit the default platforms to match the appropiate system paths

How do I update JavaFX? Must I download a new version of the JDK?

I currently have a JavaFX project running on JDK 9.0.1, and am using Eclipse Oxygen and MacOS Mojave. I have encountered a JavaFX bug that has already been acknowledged here: Assertion failure in NSEvent?. It seems that I need to update my JavaFX version to get the bug fix.
My problem is: I am unsure of what I need to know to update JavaFX. From what I can tell, JavaFX came pre-installed with my JDK. How could I check my current version of JavaFX? What would I need to do to be able to install an updated version of JavaFX with the bug fix?
A quick Google search makes it seem that I would need to re-install a new JDK in order to update JavaFX.
EDIT: Trying out How to get the version number of JavaFX? in my project, I get javafx.runtime.version: 9.0.1+11
JavaFX 11
Read up on the changes to JavaFX, now developed openly on the OpenJFX project. In the current 2018 November/December issue of Java Magazine by Oracle, see the article The Future of JavaFX by Johan Vos.
The JavaFX 11 runtime is available as a platform-specifc SDK, as a number of jmods, and as a set of artifacts in Maven Central.
The OpenJFX project seems to be led by the Gluon company, who provides this download page for both the current and early-access builds.

can not use javafx on intellij idea

I have problem importing import "javafx.util.Pair" into my program.
after searching the net I've found this answer cannot resolve symbol javafx.application in IntelliJ Idea IDE and I've installed desired jar file but still I've problem to import.
this is what I face to when open java jdk.
I don't know the why the "jfxrt.jar" is different.
note the black arrow on the folder icon
open the File | Project Structure dialog, there under Platform Settings select SDKs and then your JDK 1.8. On the right you then see all the jars that make up the classpath to your SDK. Make sure that your jfxrt.jar is in that list, if not, you can add it by clicking the '+' button at the bottom.
Update May 2020
JavaFX is no longer part of the Oracle or OpenJDK default distributions. Instead it is available as a seperate library or module set.
For instructions on using JavaFX in your application, see the documentation at:
https://openjfx.io
For instructions on working with a modern JavaFX installation and Idea, also see the related question:
IntelliJ can't recognize JavaFX 11 with OpenJDK 11
You don't need to "install the desired jar" (whatever that means).
You don't need to do that for JavaFX. You should not do anything explicitly with jfxrt.jar either in the filesystem or by adding it to a project classpath. If doing something on the filesystem, that is especially bad as jfxrt.jar is not made to be standalone and requires related native libraries shipped with the JDK in order to work.
The JavaFX code should be part of the JDK installation you are using. Perhaps you are using a Java version below 8 or an OpenJDK implementation that does not include JavaFX. If so, then install the Oracle JDK 8+ and set idea to use it. Everything should just work then and all of related JavaFX imports will resolve.

Can't use TextInputDialog in Eclipse Neon

I'm trying to run a program that uses the JavaFX scene object TextInputDialog. For some reason, it doesn't allow me to import javafx.scene.control.TextInputDialog (says "cannot be resolved").
I'm new to JavaFX, but here is what I tried. I thought it was my Java version, so I updated to the latest (1.8.0_91). I'm using Eclipse Neon 4.6.0. To install JavaFX it used the "install new software" option in the help menu, and put in the link found in step 4 of this: https://www.eclipse.org/efxclipse/install.html. After that, most of the JavaFX functions worked by adding the requisite import command. But this one doesn't.
I also found that some people have included the JavaFX library in the build path. I didn't change anything when I did that (though I'm not sure exactly what that would do since I already installed JavaFX in Eclipse).
Anyway, any suggestions would be very welcome. Thanks!
You need to make sure that eclipse is using the newer JRE for this project. You can do this by going to Project > Properties > Java Build Path and selecting the newer JRE from the list. I believe it needs to be 1.8.0_45 or newer.

Errors while setting up LibGDX on Eclipse

I have been trying to setup LibGDX on Eclipse (4.3). I followed the instructions here: https://github.com/libgdx/libgdx/wiki/Prerequisites and installed both ADT plugin for Eclipse and the Google Web toolkit successfully. Then I used the libgdx-ui.exe to create the libGDX project and on creating it, I see errors in Eclipse.
I am pretty sure I have installed the plugins properly and I have JDK 7 as well.
Any help would be greatly appreciated.
Thanks :)
It seems I have not installed the GWT plugins properly. But on trying to install it from the link, the option to install the SDK does not appear in the list.(Please check the image in the last comment I posted).
1) Android requires (before kitkat) jdk 6. It won't work with jdk 7.
2) After installing ADT plugin, you also have to open android sdk manager and download required api files.
These two should fix your android and java.lang.Object issues. It's better to test an android app on this setup (without libgdx) first.
3) Right click on all warnings regarding classpath entries, eclipse will provide you automatic quick fixes.
If the issue stays after this, the problem is with gwt sdk installation. Now you can follow The project XXX does not have any GWT SDKs on its build path. It should work smoothly as other problems won't interfere with it now.
Hope this helps.

Categories

Resources