Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4378487

Need method to determine availability of windowing system

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.2
    • client-libs
    • x86
    • linux



      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)
      ======================================================================

            mmartaksunw Michael Martak (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: