• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Why is DISPLAY needed for EditorKit?  RSS feed

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
I am using the HTMLEditorKit cnd HTMLDocument classes to read in and parse HTML. I have it working just fine but would like to understand why
the createDefaultDocument() method in the following code throws an InternalError exception when DISPLAY is not set to something reasonable.

When I set DISPLAY to something reasonable this works fine, but I would like to know what is causing createDefaultDocument() to do anything "graphical".

TIA
- Rolf.
 
author and iconoclast
Posts: 24203
43
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't tell you exactly (although if you really wanted to know, you could trace through with a debugger,) but ultimately, loading the various classes that make up Swing will eventually load the native libraries that are part of the AWT, and those will contact your X server, and if DISPLAY isn't set to something available (or the default :0.0 isn't available) then you'll have an error.

See here for a discussion of "headless" operation in JDK 1.4 and later. Basically, you may be able to avoid this issue by launching java with

java -Djava.awt.headless=true MyClass
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!