Script to check the display settings on linux

December 24, 2010 at 02:26:54
Specs: RHEL Linux
I am running a java SWING application using a script. If the DISPLAY variable is not set, it shows the following exception
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)

How can we check the DISPLAY variable of the machine using a script and to warn the user to set the DISPLAY variable?

See More: Script to check the display settings on linux

Report •

December 24, 2010 at 12:33:33
Well, just check $DISPLAY. If you know what value it should have, just set it then you won't need to check it; it won't do any harm if it's already set.

Report •
Related Solutions

Ask Question