You are not logged in.

#1 2018-07-26 08:24:10

k_viturbo
Member
Registered: 2018-07-26
Posts: 1

Running a Java GUI application within docker

I am unable to run a Java GUI application from within a docker environment. The error message is that "Can't connect to X11 window server using ':0' as the value of the DISPLAY variable"

I have tried setting the DISPLAY variable to :0 and to unix:0.

This is the command that I am using to start the docker container:

docker run --privileged --mount type=bind,source=$CNG_PATH,destination=/home/user/contiki-ng -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -ti contiker/contiki-ng

When I try to run the GUI application, I get the following error message:

run:
     [java] No protocol specified
     [java] Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
     [java]     at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
     [java]     at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
     [java]     at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
     [java]     at java.lang.Class.forName0(Native Method)
     [java]     at java.lang.Class.forName(Class.java:264)
     [java]     at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
     [java]     at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
     [java]     at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:126)
     [java]     at java.lang.Class.forName0(Native Method)
     [java]     at java.lang.Class.forName(Class.java:264)
     [java]     at java.awt.Toolkit$2.run(Toolkit.java:860)
     [java]     at java.awt.Toolkit$2.run(Toolkit.java:855)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
     [java]     at sun.swing.SwingUtilities2.getSystemMnemonicKeyMask(SwingUtilities2.java:2020)
     [java]     at javax.swing.plaf.basic.BasicLookAndFeel.initComponentDefaults(BasicLookAndFeel.java:1158)
     [java]     at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:431)
     [java]     at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:148)
     [java]     at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1577)
     [java]     at javax.swing.UIManager.setLookAndFeel(UIManager.java:539)
     [java]     at javax.swing.UIManager.setLookAndFeel(UIManager.java:579)
     [java]     at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1349)
     [java]     at javax.swing.UIManager.initialize(UIManager.java:1459)
     [java]     at javax.swing.UIManager.maybeInitialize(UIManager.java:1426)
     [java]     at javax.swing.UIManager.getInstalledLookAndFeels(UIManager.java:419)
     [java]     at org.contikios.cooja.Cooja.setLookAndFeel(Cooja.java:1238)
     [java]     at org.contikios.cooja.Cooja.main(Cooja.java:3167)
     [java] Java Result: 1

Can someone please help me with this?

Offline

Board footer

Powered by FluxBB