How to prevent headless exclusion in Java?

I have an applet, and when I try to run it on my laptop, a headless exception gives Java in the line where the JFrame is created. Now I know why JFrame usually throws an exception, but my computer was not in headless mode. I'm also still not sure what exactly the headless mode entails.

I am running Ubuntu and have a fairly recent version of java.

Also, I have successfully created JFrames, etc. in Eclipse when working with Windows on my laptop (if that helps).

+4
source share
2 answers

Have you tried setting java.awt.headless=true ? I already did this before on Solaris without an x ​​server to use the java.awt print libraries. It worked. However, this was more than five years ago, and I have no source.

See Setting java.awt.headless = true programmatically

PS Are you on an Ubuntu server or on your desktop? If the latter, I would question why Java thinks you're headless.

+3
source

Check out @ the following link that might help:

http://www.theserverside.com/discussions/thread.tss?thread_id=52535

+1
source

All Articles