Search code examples
azureazure-zuluazul-zulu

Why do I get HeadlessException on Zulu?


I just downloaded Zulu jdk zulu1.7.0_25-7.0.0.0 into my Azure Windows 2012 VM and tried to run the Memory Monitor example from the samples directory. I got the following exception. Any workarounds?

>C:\Zulu\u25\zulu1.7.0_25-7.0.0.0-win64\bin\java -jar MemoryMonitor.jar
Exception in thread "main" java.awt.HeadlessException
        at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:208)
        at java.awt.Window.<init>(Window.java:535)
        at java.awt.Frame.<init>(Frame.java:420)
        at javax.swing.JFrame.<init>(JFrame.java:224)
        at MemoryMonitor.main(MemoryMonitor.java:480)

Solution

  • Zulu is built with headless mode being on by default. However headfull mode may be enabled by adding the following flag: -Djava.awt.headless=false. This particular example can be started this way:

    C:\zulu1.7.0_25-7.0.0.0-win64\bin\java -Djava.awt.headless=false -jar MemoryMonitor.jar