-
Bug
-
Resolution: Fixed
-
P2
-
7, 7u4
-
b13
-
x86
-
os_x
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2224868 | 8 | Alexander Zuev | P2 | Closed | Fixed | b43 |
Here is a very simple test which throws error on Mac:
import java.awt.Toolkit;
import javax.swing.JTree;
public final class JTreeTest {
public static void main(final String... args) {
System.setProperty("java.awt.headless", "true");
System.out.println(Toolkit.getDefaultToolkit());
final JTree tree = new JTree();
System.out.println(tree.getPreferredSize());
}
}
The error is:
Exception in thread "main" java.lang.Error: Could not find class: sun.awt.HeadlessGraphicsEnvironment
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:116)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
at sun.swing.SwingUtilities2.isLocalDisplay(SwingUtilities2.java:1457)
at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:1556)
at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:148)
at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1592)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:535)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:575)
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1343)
at javax.swing.UIManager.initialize(UIManager.java:1432)
at javax.swing.UIManager.maybeInitialize(UIManager.java:1420)
at javax.swing.UIManager.getUI(UIManager.java:1002)
at javax.swing.JTree.updateUI(JTree.java:714)
at javax.swing.JTree.<init>(JTree.java:667)
at javax.swing.JTree.<init>(JTree.java:564)
at JTreeTest.main(JTreeTest.java:8)
Version of jdk:
java version "1.7.0_04-ea"
Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b227)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b12, mixed mode)
import java.awt.Toolkit;
import javax.swing.JTree;
public final class JTreeTest {
public static void main(final String... args) {
System.setProperty("java.awt.headless", "true");
System.out.println(Toolkit.getDefaultToolkit());
final JTree tree = new JTree();
System.out.println(tree.getPreferredSize());
}
}
The error is:
Exception in thread "main" java.lang.Error: Could not find class: sun.awt.HeadlessGraphicsEnvironment
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:116)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
at sun.swing.SwingUtilities2.isLocalDisplay(SwingUtilities2.java:1457)
at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:1556)
at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:148)
at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1592)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:535)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:575)
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1343)
at javax.swing.UIManager.initialize(UIManager.java:1432)
at javax.swing.UIManager.maybeInitialize(UIManager.java:1420)
at javax.swing.UIManager.getUI(UIManager.java:1002)
at javax.swing.JTree.updateUI(JTree.java:714)
at javax.swing.JTree.<init>(JTree.java:667)
at javax.swing.JTree.<init>(JTree.java:564)
at JTreeTest.main(JTreeTest.java:8)
Version of jdk:
java version "1.7.0_04-ea"
Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b227)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b12, mixed mode)
- backported by
-
JDK-2224868 [macosx] "Could not find class" error in JTree's ctor when called in headless mode
-
- Closed
-
- duplicates
-
JDK-7153705 [macosx] Could not instantiate sun.java2d.HeadlessGraphicsEnvironment
-
- Closed
-
-
JDK-2223177 [macosx] Could not instantiate sun.java2d.HeadlessGraphicsEnvironment
-
- Closed
-
- relates to
-
JDK-7181027 [macosx] Unable to use headless mode
-
- Closed
-