7181027: [macosx] Unable to use headless mode

Reviewed-by: anthony
This commit is contained in:
Leonid Romanov 2012-07-19 19:41:59 +04:00
parent 5f81b7f30d
commit 9134e38287
2 changed files with 4 additions and 6 deletions

View File

@ -170,12 +170,12 @@ public abstract class GraphicsEnvironment {
if (System.getProperty("javaplugin.version") != null) {
headless = defaultHeadless = Boolean.FALSE;
} else {
if ("sun.awt.HeadlessGraphicsEnvironment".equals(
System.getProperty("java.awt.graphicsenv")))
String osName = System.getProperty("os.name");
if (osName.contains("OS X") && "sun.awt.HToolkit".equals(
System.getProperty("awt.toolkit")))
{
headless = defaultHeadless = Boolean.TRUE;
} else {
String osName = System.getProperty("os.name");
headless = defaultHeadless =
Boolean.valueOf(("Linux".equals(osName) ||
"SunOS".equals(osName) ||

View File

@ -398,6 +398,7 @@ GetJavaProperties(JNIEnv *env)
PreferredToolkit prefToolkit = getPreferredToolkit();
switch (prefToolkit) {
case CToolkit:
case HToolkit:
sprops.graphics_env = "sun.awt.CGraphicsEnvironment";
break;
case XToolkit:
@ -405,9 +406,6 @@ GetJavaProperties(JNIEnv *env)
sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
#ifdef MACOSX
break;
default:
sprops.graphics_env = "sun.java2d.HeadlessGraphicsEnvironment";
break;
}
#endif
/* AWT properties */