Java invokes a local graphics processing library while graphics processing. When you use Java for graphics processing (such as image scaling, picture signing, generating reports), running on Windows will not be a problem. If you migrate your program to Linux/unix, you may have errors that graphics cannot display.
Hint: "Can ' t connect to X11 Window Server" This is because Linux graphics processing requires an X server server.
Solution:
1. If a graphical interface is installed on the server, you can fix it by setting the environment variable: dispaly=127.0.0.1:0.0.
2. If the graphical interface is not installed, you can add parameters to the Java Runtime:-djava.awt.headless=true.
3. Use the PJA library to replace the local graphics processing library.
The changes to Tomcat are as follows:
After opening the%tomcat_home%/bin/catalina.sh file in-djava.io.tmpdir= "$CATALINA _tmpdir", start the Tomcat script plus:-djava.awt.headless=true
"$_runjava" $JAVA _opts $CATALINA _opts
-djava.endorsed.dirs= "$JAVA _endorsed_dirs"
-classpath "$CLASSPATH"
-dcatalina.base= "$CATALINA _base"
-dcatalina.home= "$CATALINA _home"
-djava.io.tmpdir= "$CATALINA _tmpdir"
-djava.awt.headless=true
Org.apache.catalina.startup.Bootstrap "$@" start
>> "$CATALINA _base"/logs/catalina.out 2>&1 &
if [!-Z "$CATALINA _pid"]; Then
Echo $! > $CATALINA _pid fi
Fielif ["$" = "Stop"]; Then
Once saved, the graphic can be processed by restarting.