-
Bug
-
Resolution: Duplicate
-
P3
-
7
-
x86
-
os_x
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2223177 | 7u6 | Leonid Romanov | P3 | Closed | Duplicate |
Mac OS X 10.7.3 macmini4,1
Login remotely with ssh to a Mac like this.
// --- Compile and run:
import java.awt.*;
public class AF {
public static void main(String args[]) {
Frame frame = new Frame("frame");
frame.setBounds(50,50,300,300);
System.err.println("Frame: "+frame);
}
}
//------------------------
You will get:
Exception in thread "main" java.lang.Error: Could not instantiate Graphics Environment: sun.java2d.HeadlessGraphicsEnvironment
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:118)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
at java.awt.Window.initGC(Window.java:466)
at java.awt.Window.init(Window.java:486)
at java.awt.Window.<init>(Window.java:535)
at java.awt.Frame.<init>(Frame.java:420)
at AF.main(AF.java:5)
See issues in MACOSX jira, there's some 3 of them: http://java.net/jira/browse/MACOSX_PORT-111, 765 etc. -- in 111 a final fix is, to use
CToolkit when the Aqua environment is available, fallback to X11 if the $DISPLAY environment variable is set, otherwise go headless.
Now we see that headless doesn't work.
Login remotely with ssh to a Mac like this.
// --- Compile and run:
import java.awt.*;
public class AF {
public static void main(String args[]) {
Frame frame = new Frame("frame");
frame.setBounds(50,50,300,300);
System.err.println("Frame: "+frame);
}
}
//------------------------
You will get:
Exception in thread "main" java.lang.Error: Could not instantiate Graphics Environment: sun.java2d.HeadlessGraphicsEnvironment
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:118)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
at java.awt.Window.initGC(Window.java:466)
at java.awt.Window.init(Window.java:486)
at java.awt.Window.<init>(Window.java:535)
at java.awt.Frame.<init>(Frame.java:420)
at AF.main(AF.java:5)
See issues in MACOSX jira, there's some 3 of them: http://java.net/jira/browse/MACOSX_PORT-111, 765 etc. -- in 111 a final fix is, to use
CToolkit when the Aqua environment is available, fallback to X11 if the $DISPLAY environment variable is set, otherwise go headless.
Now we see that headless doesn't work.
- backported by
-
JDK-2223177 [macosx] Could not instantiate sun.java2d.HeadlessGraphicsEnvironment
-
- Closed
-
- duplicates
-
JDK-7144064 [macosx] "Could not find class" error in JTree's ctor when called in headless mode
-
- Closed
-