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

Linux : Headless mode requires X-Windows to be installed on the system

XMLWordPrintable

    • x86
    • linux

      Name: jk109818 Date: 01/23/2002


      FULL PRODUCT VERSION :
      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build
      1.4.0-beta3-b84)
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed
      mode)


      FULL OPERATING SYSTEM VERSION :
      # rpm -q glibc
      glibc-2.1.3-14tr
      #
      # uname -a
      Linux ppnserv001 2.2.19-4tr #1 Fri May 25 10:42:44 CEST
      2001 i686 unknown
      #
      #cat /etc/release
      Trustix Secure Linux release 1.2 (Anywhere)
      #


      A DESCRIPTION OF THE PROBLEM :
      Headless mode does not work becasue it requires an X
      Windows library to be installed on the Operating System

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      build the following program
      # cat t1.java
      import java.awt.GraphicsEnvironment;
      import java.awt.image.BufferedImage;
      public class t1
      {
        public static void main(String[] args)
        {
          if (GraphicsEnvironment.isHeadless())
          {
            System.out.println("Its headless");
            BufferedImage bi = new BufferedImage
      (10,10,BufferedImage.TYPE_INT_RGB);
          }
          else
          {
            System.out.println("Its not headless");
          }
        }
      }
      #

      Run with the command
      # java -Djava.awt.headless=true t1


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      expected result:
      #
      Its headless
      #

      Actual result:
      #
      Its headless
      Exception in thread "main"
      java.lang.UnsatisfiedLinkError: /usr/java/j2sdk1.4.0/jre/lib
      /i386/libawt.so: libXp.so.6: cannot open shared object
      file: No such file or directory
              at java.lang.ClassLoader$NativeLibrary.load(Native
      Method)
              at java.lang.ClassLoader.loadLibrary0
      (ClassLoader.java:1483)
              at java.lang.ClassLoader.loadLibrary
      (ClassLoader.java:1399)
              at java.lang.Runtime.loadLibrary0(Runtime.java:775)
              at java.lang.System.loadLibrary(System.java:835)
              at sun.security.action.LoadLibraryAction.run
      (LoadLibraryAction.java:53)
              at java.security.AccessController.doPrivileged
      (Native Method)
              at java.awt.image.ColorModel.loadLibraries
      (ColorModel.java:191)
              at java.awt.image.ColorModel.<clinit>
      (ColorModel.java:199)
              at java.awt.image.BufferedImage.<clinit>
      (BufferedImage.java:215)
              at t1.main(t1.java:10)


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      /i386/libawt.so: libXp.so.6: cannot open shared object
      file: No such file or directory
              at java.lang.ClassLoader$NativeLibrary.load(Native
      Method)
              at java.lang.ClassLoader.loadLibrary0
      (ClassLoader.java:1483)
              at java.lang.ClassLoader.loadLibrary
      (ClassLoader.java:1399)
              at java.lang.Runtime.loadLibrary0(Runtime.java:775)
              at java.lang.System.loadLibrary(System.java:835)
              at sun.security.action.LoadLibraryAction.run
      (LoadLibraryAction.java:53)
              at java.security.AccessController.doPrivileged
      (Native Method)
              at java.awt.image.ColorModel.loadLibraries
      (ColorModel.java:191)
              at java.awt.image.ColorModel.<clinit>
      (ColorModel.java:199)
              at java.awt.image.BufferedImage.<clinit>
      (BufferedImage.java:215)
              at t1.main(t1.java:10)


      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.GraphicsEnvironment;
      import java.awt.image.BufferedImage;
      public class t1
      {
        public static void main(String[] args)
        {
          if (GraphicsEnvironment.isHeadless())
          {
            System.out.println("Its headless");
            BufferedImage bi = new BufferedImage
      (10,10,BufferedImage.TYPE_INT_RGB);
          }
          else
          {
            System.out.println("Its not headless");
          }
        }
      }
      ---------- END SOURCE ----------
      (Review ID: 137422)
      ======================================================================

            art Artem Ananiev (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: