• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why is DISPLAY needed for EditorKit?  RSS feed

 
Rolf Johansson
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.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!