aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Headless Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Headless Exception" Watch "Headless Exception" New topic
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: 19557
    
  16

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 - OCEEJBD 6
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: 19557
    
  16

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: http://aspose.com/file-tools
 
subject: Headless Exception
 
Similar Threads
error while executing applet in UNIX
How to view applet from unix box
Mac-specific applet-Javascript communication problem
class not found exception javax.jms.MessageListener
RMI & X11 Winodws