I am trying to make a derivation of a screen sharing Java application I need for work for my own use and I’m getting a weird Java error when I run the application:
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using '/nix/store/1q9lw4r2mbap8rsr8cja46nap6wvrw2p-bash-interactive-5.2p37/bin/sh:' as the v
at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:105)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
at java.desktop/sun.awt.X11GraphicsEnvironment.initStatic(X11GraphicsEnvironment.java:64)
at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:59)
at java.desktop/sun.awt.PlatformGraphicsInfo.createGE(PlatformGraphicsInfo.java:37)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:91)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:82)
at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:104)
at java.desktop/sun.awt.X11.XToolkit.<clinit>(XToolkit.java:225)
at java.desktop/sun.awt.PlatformGraphicsInfo.createToolkit(PlatformGraphicsInfo.java:41)
at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:595)
at com.screenconnect.client.Program$MainAction$1.run(Program.java:143)
at com.screenconnect.client.Program.main(Program.java:133)
Can't connect to X11 window server using '...' as the v
seems to be a cut off version of the error message Can't connect to X11 window server using '...' as the value of the DISPLAY variable
which is quite common. But what I’m failing to understand is how the application is mixing up the nix store path for sh which links to bash as the DISPLAY environment variable. Esspecially when DISPLAY=:0 in the environment it is running and other X11 apps like xeyes launch and even a basic X11 java .class app.
Anyone have any idea what could be happening here?