| Author |
Headless Exception
|
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
Hi ,
When i tried to call an legacy applet class , i get this exception
Exception : java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
i have no clue about the class , except that it extends Applet. Can someone explain what this X11 all about ? When such exceptions occurs ?
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19214
|
|
How are you trying to run the applet? Are you inside a windowed environment like KDE, GNOME, Xfce, ...? Or do you only have a terminal?
Since DISPLAY is not set (which will mostly happen automatically when starting KDE, GNOME etc) my guess is the latter, and that makes it hard to display the applet (or any GUI). Because the JVM cannot find a proper environment to display on it will throw a HeadlessException.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
Rob ,
I have added this java -Djava.awt.headless=true to skip the exception. I did this just because the use of that file is pack String arrays , and not sure why it extends Applet ?!?! so anyways Thanks and things working fine..
Does this suppression (-Djava.awt.headless=true ) has any consequences ?
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19214
|
|
Balu Sadhasivam wrote:the use of that file is pack String arrays , and not sure why it extends Applet ?!?!
Bad design obviously.
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
Rob Prime wrote:
Balu Sadhasivam wrote:the use of that file is pack String arrays , and not sure why it extends Applet ?!?!
Bad design obviously.
Well thats part and parcel of legacy systems..
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Headless Exception
|
|
|