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.

> 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.

I'm not sure why you take this trouble, can't you control or at least
reliably determine the run time environment in advance? You can
install PJA in case you encounter a headless Java 1.3 environment.

> On a related note, what are our criteria
> for determining support of various Java platforms?

There is a rule of thumb to support older environments up to two
years after the next major upgrade was available, perhaps with
slight restrictions. It depends on how much inconvenience this brings
to users of more recent versions, and on how much users of older
versions complain. There are people stuck with MS Java or IMB's
1.1.8 JRE on OS/390 USS, but they never showed up in person when it
came to discussions about dropping Java 1.1 support.

J.Pietschmann


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

Reply via email to