JDK 7/8 falling back to headless toolkit in ssh login session
anthony.petrov at oracle.com
Mon May 27 07:51:06 PDT 2013
We explicitly decided to fall back to the headless mode when running
over ssh. Please see this message:
On 05/24/13 23:16, Phil Race wrote:
> When we ssh into an OS X system as the currently logged in user, we
> would like to run automated tests that display on the screen. However
> I found that I need to explicitly tell it the toolkit to use to get this
> to work
> "AWT_TOOLKIT=CToolkit java ..."
> else it falls back into a path where it selects the headless toolkit
> which then complains when we try to create a window :
> java -jar SwingSet2.jar
> Exception in thread "main" java.awt.HeadlessException:
> No X11 DISPLAY variable was set, but this program performed an operation
> which requires it.
> at SwingSet2.main(SwingSet2.java:222)
> The X11 message is a bit confusing but is basically the fallback code
> that the headful toolkit would have been X11.
> And SwingSet2 uses the SplashScreen API which displays an image before
> AWT starts running, so we get the oddity that you see the splash screen
> for a moment before AWT decides that can't have been possible and shuts
> down :-)
> The ultimate root of the problem is a function called "isInAquaSession"
> which uses
> The OSX GetSessionInfo call. JFK checks the returned bit flag for
> which is however "clear", even though as far as I can tell, it should be
> SwingSet2 seems to work just fine when run as
> AWT_TOOLKIT=CToolkit java -jar SwingSet2.jar
> So it appears GetSessionInfo is unreliable, or maybe too picky over
> that doesn't matter ?
> So are we required to forever use the workaround above, or is there
> we can do to get the right answer ?
More information about the macosx-port-dev