Ask Your Question
0

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 FirstSwingExample.java I get this error:

Exception in thread "main" java.awt.HeadlessException
    at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
    at java.awt.Window.<init>(Window.java:536)
    at java.awt.Frame.<init>(Frame.java:420)
    at java.awt.Frame.<init>(Frame.java:385)
    at javax.swing.JFrame.<init>(JFrame.java:189)
    at FirstSwingExample.main(FirstSwingExample.java:8)

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
3

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 1,655 times

Last updated: Mar 03 '17