Responses below.

-----Original Message-----
From: J.Pietschmann [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 15, 2002 3:05 PM
To: [EMAIL PROTECTED]
Subject: Re: fonts


>>Victor Mote wrote:
> OK, here is a related question that does not appear to be an FAQ (per my
> review of FOP, Batik, and Cocoon lists). If I try:
>     ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
> 
> in a headless environment, I get a runtime error that halts the JVM.

This is interesting, but you'll probably get more and better
answers on comp.lang.java or a more specialized Java forum.<

I'm curious.  What's the error and stacktrace for that error?  Have you tried catching 
things of type Throwable?

> There
> does not seem to be a way to catch the error and skip the offending code
> (which is all I really need to do). It looks like 1.4 will throw a
> HeadlessException, and also gives a GraphicsEnvironment.isHeadless() method,
> both of which are helpful. However, in 1.3, I don't see a clean way to
> detect this -- I could probably do something klunky like looking at the
> $TERM variable & trying to figure it out from there.

I'd go for the DISPLAY environment variable: if it's not set, you
are most probably running headless. There is a slight possibility
you are on a system which would connect to a local X server anyway,
so just to be really, really sure open a socket to localhost:6000, and
perhaps emulate XOpenDisplay if there is something listening there.<<

Sun has looked on environment variables with derision, and the 1.3 JDK deprecates the 
mechanisms by which you can extract them in Java.  IIRC, the getenv mechanism was 
actually de-implmented in JDK 1.4.  You might face similar trouble in 1.3.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to