Ask Your Question

Headless Java on a Desktop

asked 2017-03-03 19:38:01 -0500

Dima gravatar image

updated 2017-03-03 19:39:14 -0500

Hello, Ive been trying to learn Java Swing but for some reason my java thinks that my desktop is a server and I therefore get headless exception errors and can't make a display. When I try to run I get this error:

Exception in thread "main" java.awt.HeadlessException
    at java.awt.GraphicsEnvironment.checkHeadless(
    at java.awt.Window.<init>(
    at java.awt.Frame.<init>(
    at java.awt.Frame.<init>(
    at javax.swing.JFrame.<init>(
    at FirstSwingExample.main(

I'm not sure what to do because there doesn't seem to be much information about this.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-03 19:43:40 -0500

Dima gravatar image

Seems I found the answer; fedora seems to be headless by default, I fixed it by installing java 1.8.0 openjdk:

$ sudo dnf install java-1.8.0-openjdk
edit flag offensive delete link more

Question Tools


Asked: 2017-03-03 19:38:01 -0500

Seen: 2,038 times

Last updated: Mar 03 '17