This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Headless Exception  RSS feed

 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21087
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 21087
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!