I'm trying to run a very simple "hello world" Java application with swing on my computer where I have installed Ubuntu 22.04.2.
I have installed Java SDK 17 and have JAVA_HOME set on my ~/.bashrc
:
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
I'm getting this error:
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
I have tried to set the DISPLAY value with:
unset DISPLAY
export DISPLAY=:0
Please advise. Thanks.