• Home
  • Contact Me
  • About Me
  • Resources
  • Favorites
  • Earn Money

Thursday, July 24, 2008

How to resolve problem with X11GraphicsEnvironment in unix

Are you planning to display report or graphics in web application running in unix operating system? Are you getting error similar to below error?

java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:175)

This error is very common in unix with NO X environment. Here, I am trying to give couple of troubleshooting steps. Those are as follows:

  1. Set up headless mode: To set up headless mode, set the appropriate system property by using the setProperty() method. This method enables you to set the desired value for the system property that is indicated by the specific key.
    System.setProperty("java.awt.headless", "true");
  2. Set Java Environment Variable: Djava.awt.headless=true
  3. In JVM Process Definition of WAS, we need to create variable DISPLAYwith port # on which X11 is running, the Value field (default is:0.0).
    example :
    DISPLAY=0.0
  4. X11 server is running: If running please note the port number by issuing following command
    ps -ef egrep X11
  5. Setting the DISPLAY variable using script or in cell by issuing,setenv DISPLAY=:0.0 export DISPLAY
  6. Use the xhost + command to make this variable to global scope with above

Follow above steps one at a time and carry a test.

Regards

Monu



No comments: