Q: The graphic report failed to be displayed and exceptions occurred.
A: On Linux or Unix OS, an exception is thrown by the Java AWT toolkit when it
can not make a connection to an X11 server. The exception can be something like
"Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable".
If your OS has graphics support, you need make sure that the local X11 is running,
and the DISPLAY variable is correctly set.
If you are on a unix server that does not provide a graphical user environment,
there are three options:
1. Sun JDK 1.4 Headless mode
If you are using JDK 1.4, then you can use the Headless graphics mode to launch
the server, ie, you can add a java argument of -Djava.awt.headless=true.
For example, with Tomcat, add the following line in cataline.sh (or setclasspath.sh):
JAVA_OPTS=-Djava.awt.headless=true
Note that, it seems the presense of X11 runtime libraries is still needed, that
is, an X11 environment must be installed into the system, but the X11 server
itself need not be started. For example, for RedHat Linux, the minimum set
of X11 packages needed is:
* XFree86
* XFree86-libs
In the case of Fedora, it may use Xorg instead of XFree86. After adding headless option
and you get an error like:
java.lang.UnsatisfiedLinkError:
/usr/java/j2sdk1.4.1_02/jre/lib/i386/libfontmanager.so:
libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory
then, you need install
compat-libstdc++-7.3-2.96.126.i386.rpm
2. Virtual X11 Frame Buffer (Xvfb)
For JDK 1.3, the headless mode is not available. If you do not have X11 sever,
you can install a lightweight Xvfb (XFree86-Xvfb package).
In your server launch script (such as tomcat.sh), add the following lines:
if [ -f /usr/X11R6/bin/Xvfb ]; then
/usr/X11R6/bin/Xvfb :1 -screen 0 1x1x8 > /dev/null 2>&1 &
fi
export DISPLAY=:1.0
3. Pure Java AWT (PJA)
Another option is PJA. For more detail and to download the software, go to
http://www.eteks.com/pja/en/.
|
* Reference brought to you by
Bugzero, it's more than just bug tracking software!
|
Home -
FAQs
|
|