JDK-7153705 : [macosx] Could not instantiate sun.java2d.HeadlessGraphicsEnvironment
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-03-14
  • Updated: 2012-04-28
  • Resolved: 2012-04-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7u6Resolved 8Resolved
Related Reports
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");
        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.

EVALUATION assigned to the RE of http://java.net/jira/browse/MACOSX_PORT-111

EVALUATION There's indeed an issue with crating an instance of the GE class which needs to be fixed (the issue is related to 7144064). However, please note that Oracle JDK on the Mac does not support running GUI apps over an SSH connection. The headless mode is forced in this case, and as such no GUI is possible [1]. So I'm updating the synopsis to better reflect the issue that needs to be fixed in terms of this CR. [1] http://java.net/jira/browse/MACOSX_PORT-774