Java no x11 variable error but no remote setup

when attempting to launch arduino without any options, im getting this error:

Picked up JAVA_TOOL_OPTIONS: 
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/java.awt.SplashScreen.getSplashScreen(Unknown Source)
	at processing.app.Base.<init>(Base.java:240)
	at processing.app.Base.main(Base.java:150)

I have tried searching for the issue but it seems like no one encountered this on manjaro yet.
I am on newest versions on everything.
Please help me fix this issue

You need to:

  • Run this script inside a terminal (not tty)
  • You need to be loged in as user in this terminal (not root)
  • Set X11DISPLAY in bash and export it
  • Have any java (jdk/jre) installed (not only headless)

:footprints:

Welcome to Manjaro! :smiling_face_with_three_hearts:

  1. Please read the information behind this link. It will help you to post necessary information.
  1. Please press the three dots below your post and then press the :pencil2:
  • If you give us information about your system, we can see what we’re talking about and make better suggestions.
  • You can do this by using inxi in a terminal or in console.
sudo inxi --admin --verbosity=7 --filter --no-host --width
  • Personally identifiable information such as serial numbers and MAC addresses are filtered out by this command
  • Presenting the information in this way allows everyone to be familiar with the format and quickly find the items they need without missing anything.
  1. Copy the output from inxi (including the command) and paste it into your post.
  • To make it more readable, add 3 backticks ``` on an extra line before and after the pasted text.

Have you already :mag: for your problem in the forum ? (Wisdom lies in asking → listening → reading :wink: )

I think it’s actually the $DISPLAY variable:

$ echo $X11

$ echo $DISPLAY
:0

:innocent:

1 Like

My responses to your bullet points:

  • Im running gnome and used their terminal to launch arduino
  • i was logged in while running the command
  • Ill have to look into this one
  • I have jre-openjdk installed (11,17 and 8), as well as the headless versions

I got the same outputs

1 Like

Then it seems that environment variable isn’t globally set. I don’t know how else to put it.

You might try that following. Not sure if it’ll work, but it’s easy to undo if it doesn’t:

Append the line:

DIAPLAY=:0

…to the bottom of your ~/.zshrc file, if you use zsh, or ~/.bashrc file, if you’re using bash.

Then you can try again.

If it doesn’t help, simply remove that ling from where you added it. And know that I obviously don’t know where to go from here…

I have both files so I tried both with reboots after setting the variables.
Nothing worked or got me any other error

Hmmm…

I think you need to do X forwarding over SSH if that’s what you’re trying to achieve? But I’m not sure what you’re trying to accomplish, and neither have I any experience with X11 forwarding if it is indeed it…

So :man_shrugging:

:sob:

But which of them is active(default) ?

archlinux-java status

Available Java environments:
  java-11-openjdk
  java-17-openjdk
  java-20-graalvm
  java-21-openjdk (default)
  java-21-openjdk-bin
  java-22-openjdk
  java-8-openjdk
echo $DISPLAY

:1.0
java -version

openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35)
OpenJDK 64-Bit Server VM (build 21+35, mixed mode, sharing)

I don’t want to do anything SSH-related.
I want to run the arduino IDE on my local machine.

Available Java environments:
 java-11-openjdk
 java-17-openjdk
 java-21-openjdk (default)
 java-8-openjdk/jre

seems like I missed 21 on that list

will changing the display variable do something to my ability to boot my pc correctly?

openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35)
OpenJDK 64-Bit Server VM (build 21+35, mixed mode, sharing)

When you invoke a terminal inside a DE, every java-program launched from the terminal can work inside the terminal.
If the DISPLAY variable is set, the java-program is able to connect to your desktop, and can launch a GUI and interact with it. (Like writing into and reading clipboard, and doing D&D)

This will not affect booting :wink:

https://bbs.archlinux.org/viewtopic.php?id=97763

echo $DISPLAY
:1.0

arduino 
Picked up JAVA_TOOL_OPTIONS: 
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/java.awt.SplashScreen.getSplashScreen(Unknown Source)
	at processing.app.Base.<init>(Base.java:240)
	at processing.app.Base.main(Base.java:150)

if the devs wrote their error detection well, I would think that it just cant see the display variable or detect any java version thats installed

No it did detect java, because the error comes out of java

But it may be a headless(non-gui) java version which is not able to connect to the display.

What about something like:

echo "DISPLAY=$DISPLAY" ; java -version; export DISPLAY ; arduino;

P.S. arduino does work in my pc (xfce, java21)

 cat /usr/bin/arduino

#!/bin/sh
export PATH=/usr/lib/jvm/java-8-openjdk/bin/:"$PATH"
exec /usr/share/arduino/arduino "$@"

Even /usr/share/arduino/arduino works for me even better with java21 :man_shrugging:

DISPLAY=:1.0
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35)
OpenJDK 64-Bit Server VM (build 21+35, mixed mode, sharing)
Picked up JAVA_TOOL_OPTIONS: 
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/java.awt.SplashScreen.getSplashScreen(Unknown Source)
	at processing.app.Base.<init>(Base.java:240)
	at processing.app.Base.main(Base.java:150)

From terminal, run:

  1. sudo pacman -S arduino jdk8-openjdk
  2. sudo archlinux-java set java-8-openjdk
  3. env GDK_BACKEND=x11 arduino
1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.