提交 46d54ef2 编写于 作者: L leonidr

7181027: [macosx] Unable to use headless mode

Reviewed-by: anthony
上级 ea0c084e
...@@ -170,12 +170,12 @@ public abstract class GraphicsEnvironment { ...@@ -170,12 +170,12 @@ public abstract class GraphicsEnvironment {
if (System.getProperty("javaplugin.version") != null) { if (System.getProperty("javaplugin.version") != null) {
headless = defaultHeadless = Boolean.FALSE; headless = defaultHeadless = Boolean.FALSE;
} else { } else {
if ("sun.awt.HeadlessGraphicsEnvironment".equals( String osName = System.getProperty("os.name");
System.getProperty("java.awt.graphicsenv"))) if (osName.contains("OS X") && "sun.awt.HToolkit".equals(
System.getProperty("awt.toolkit")))
{ {
headless = defaultHeadless = Boolean.TRUE; headless = defaultHeadless = Boolean.TRUE;
} else { } else {
String osName = System.getProperty("os.name");
headless = defaultHeadless = headless = defaultHeadless =
Boolean.valueOf(("Linux".equals(osName) || Boolean.valueOf(("Linux".equals(osName) ||
"SunOS".equals(osName) || "SunOS".equals(osName) ||
......
...@@ -398,6 +398,7 @@ GetJavaProperties(JNIEnv *env) ...@@ -398,6 +398,7 @@ GetJavaProperties(JNIEnv *env)
PreferredToolkit prefToolkit = getPreferredToolkit(); PreferredToolkit prefToolkit = getPreferredToolkit();
switch (prefToolkit) { switch (prefToolkit) {
case CToolkit: case CToolkit:
case HToolkit:
sprops.graphics_env = "sun.awt.CGraphicsEnvironment"; sprops.graphics_env = "sun.awt.CGraphicsEnvironment";
break; break;
case XToolkit: case XToolkit:
...@@ -405,9 +406,6 @@ GetJavaProperties(JNIEnv *env) ...@@ -405,9 +406,6 @@ GetJavaProperties(JNIEnv *env)
sprops.graphics_env = "sun.awt.X11GraphicsEnvironment"; sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
#ifdef MACOSX #ifdef MACOSX
break; break;
default:
sprops.graphics_env = "sun.java2d.HeadlessGraphicsEnvironment";
break;
} }
#endif #endif
/* AWT properties */ /* AWT properties */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册