I had the same problem in Xubuntu 18.04 with Eclipse 2018-12 (4.10.0). It was working fine, but probably some update in the system (or to OpenJDK specifically) started this problem. In addition Gradle Tasks weren't showing up in the Gradle Window.
I solved the issue removing packages: default-jre
, default-jdk
, default-jre-headless
, default-jdk-headless
, all of them are "pointing at" openjdk-11
.
Then I installed packages: openjdk-8-jre
, openjdk-8-jdk
, openjdk-8-jre-headless
and openjdk-8-jdk-headless
.
Change eclipse.ini
's vm section to:
-vm /usr/lib/jvm/java-8-openjdk-amd64/bin
And now everything is working fine, and Gradle tasks are showing again. To clarify, I'm also using LibGDX.
lwjgl
to lwjgl3
I had the same issue as you with OpenJDK 11 / Java 11 (openjdk 11.0.10 2021-01-19
). What fixed it was switching to lwjgl3
everywhere, which incidentally also fixed some other issues for me! (whole screen going black when I exit the app, mouse cursor capture only partially working, etc)
In build.gradle
change the first into the second block:
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
Also adjust your imports (e.g. in the DesktopLauncher
class):
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
lwjgl3
should be almost entirely compatible, in my case I just needed to update the config:
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.samples = 8;
config.height = 720;
config.width = 1280;
config.vSyncEnabled = true;
new LwjglApplication(new RangeAnxietyGame(), config);
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setBackBufferConfig(8, 8, 8, 8, 16, 0, 8);
config.setWindowedMode(1280, 720);
config.useVsync(true);
new Lwjgl3Application(new RangeAnxietyGame(), config);
openjdk-11
with adopt-openjdk-11
This problem also showed up for me while using libgdx on Ubuntu 20.04 with openjdk-11.
After a longer struggle I tried another JDK vendor instead of openjdk. This solved my issue. For some reason adopt-opendjk-11
works, while openjdk-11
was not working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With