Name: rmT116609 Date: 10/11/2000
java version "1.2.2"
Classic VM (build 1.2.2_006, green threads, nojit)
On some platforms and in some situations the JVM may not be able to create and
display graphical components due to the absence of a windowing system (i.e.
Windows / X). In particular, a Linux system may not have X installed, or the
current user may be connecting remotely via telnet etc.
The awt should provide a means of determining whether or not this is the case.
I am developing an application which runs both as a text-mode app and with a
graphical UI and I want to be able to determine which UI to use on a particular
occasion.
Ideally there should be a method such as Toolkit.isWindowingSystemAvailable(),
but if that is not possible, there should at least be a descriptive exception
(i.e. NOT InternalError) thrown if this problem is encountered. Currently the
following code, when run during a telnet session to a Linux (JDK 1.2.2) box,
produces the error message:
"Exception in thread "main" java.lang.InternalError: Can't connect to X11
window server using ':0.0' as the value of the DISPLAY variable."
import javax.swing.*;
public class GTest
{
public static void main(String[] args)
{
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.show();
}
}
(Review ID: 110732)
======================================================================