. Advertisement .
. Advertisement .
Hi everyone, I’m learning about java. While working, I try to install a Java application on my Linux machine (Slackware). As a result, I get the message:
~$ java -jar gate-5.0-beta1-build3048-installer.jar - ERROR - java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. at java.awt.GraphicsEnvironment.checkHeadless(Graphic sEnvironment.java:159) at java.awt.Window.<init>(Window.java:407) at java.awt.Frame.<init>(Frame.java:402) at net.sourceforge.mlf.metouia.borders.MetouiaDotsBuf fer.<init>(MetouiaDotsBuffer.java:105) at net.sourceforge.mlf.metouia.borders.MetouiaDots.<i nit>(MetouiaDots.java:66) at net.sourceforge.mlf.metouia.borders.MetouiaToolBar Border.<init>(MetouiaToolBarBorder.java:49) at net.sourceforge.mlf.metouia.MetouiaLookAndFeel.ini tComponentDefaults(MetouiaLookAndFeel.java:241) at javax.swing.plaf.basic.BasicLookAndFeel.getDefault s(BasicLookAndFeel.java:130) at javax.swing.plaf.metal.MetalLookAndFeel.getDefault s(MetalLookAndFeel.java:1591) at javax.swing.UIManager.setLookAndFeel(UIManager.jav a:537) at javax.swing.UIManager.setLookAndFeel(UIManager.jav a:581) at com.izforge.izpack.installer.GUIInstaller.loadLook AndFeel(GUIInstaller.java:373) at com.izforge.izpack.installer.GUIInstaller.<init>(G UIInstaller.java:116) at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Construc tor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:30 at com.izforge.izpack.installer.Installer.main(Instal ler.java:62)
What can I do about the “no x11 display variable was set, but this program performed an operation which requires it” issue? Is there a better approach?
Your app is not set automatically, it makes me surprised. I don’t know whether you are trying to start this application from a non-graphic terminal or change the default .profile, .login, .bashrc or .cshrc or not. And I found that the DISPLAY environment variable has not been set correctly. I think these are the reason of your error.
Noting that the DISPLAY value must be set to 0.0, it means that you use your user ID to log in to the main display. If it isn’t logged on or if it uses a different userrid, this will not success.
If you are from another computer and are at the main display, you can use “ssh –X hostname” (sudo -X) to connect to the host and ssh will send the X display back. ssh also checks that the DISPLAY variable is correctly set (provided it’s not being altered in the dot files). The value of “localhost:11.0” is a DISPLAY environment variable in a “ssh –X” session, it points to the socket that ssh tunnels to your local box.
If you are on the main display, let’s do this:
or if you use csh/tcsh, do as follow:
Is this being done in an X11 environment A terminal window can be used, but it must be within X (either by running startx or after a graphical login).
Export DISPLAY=0 for bash-like shells (bash and sh) or setenv.DISPLAY:0 to access C shell-based shells like csh and tcsh (csh and tcsh) if you are already in a graphical environment.
You can connect from another machine using SSH. If there is an X server running, such as xming or your standard Linux Xserver, the -X option will display the graphical interface.