I'm getting this error running my app: ```Exceptio...
# compose-desktop
m
I'm getting this error running my app:
Copy code
Exception in thread "main" java.awt.HeadlessException: 
No X11 DISPLAY variable was set,
or no headful library support was found,
but this program performed an operation which requires it,


	at java.desktop/sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:58)
	at androidx.compose.ui.window.LayoutConfiguration_desktopKt.getGlobalDensity(LayoutConfiguration.desktop.kt:41)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1.invoke(Application.desktop.kt:226)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1.invoke(Application.desktop.kt:221)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.kt:121)
What do I do? I'm running KDE Wayland
t
Have you a JRE Headless installed? Maybe set the headless to
true
. on Gradle properties or terminal
-D
property.
m
I don't think so, I'm just using OpenJDK 21
m
Forcibly setting headless to false:
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
I think it's caused by intellij/gradle not passing the DISPLAY env var to the
desktop
task?
j
I also recently started to encounter this issue. Same project used to work fine. I suspect it broke with some driver/system updates, because I didn't change anything with the project. Running Ubuntu 24.04