问题
Getting a java.awt.HeadlessException seems to be a pretty common issue and has been discussed in the. following questions:
- "No X11 DISPLAY variable" - what does it mean?
- Getting a HeadlessException: No X11 DISPLAY variable was set
- 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
The solutions suggest to make sure your X11 forwarding is active e.g. by running
ssh -Y
or
ssh -X
checking your DISPLAY variable
echo $DISPLAY
somemachine:10.0
and trying to run gui software like
xclock
Well - after doing all these things successfully I still get
Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
Environment:
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
or
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
This is on Mac OS X El Capitan. Via screen sharing mode the software works.
What could be done to further debug and then fix this issue?
For the time being I'll check what the warning:
Warning: No xauth data; using fake authentication data for X11 forwarding.
might have to do with it.
来源:https://stackoverflow.com/questions/44616348/xclock-works-x11-display-set-but-still-java-awt-headlessexception