Java calls the local graphics processing library when graphics are processed. When using Java for graphical processing (such as image scaling, image signing, generating reports), there is no problem when running on Windows. If the program is ported to Linux/unix, it is possible that graphics cannot display errors.
Hint message: "Can ' t connect to X11 Window Server" This is because Linux graphics processing requires an X server server.
Workaround:
- If you have a graphical interface installed on your server, you can resolve it by setting the environment variable: dispaly=127.0.0.1:0.0.
- If you do not have a graphical interface installed, you can add parameters to the Java Runtime:-djava.awt.headless=true.
- Use the Pja library instead of the local graphics processing library.
The changes to Tomcat are as follows:
Open%tomcat_home%/bin/catalina.sh File
Position 1: After-djava.io.tmpdir= "$CATALINA _tmpdir", the script that launches Tomcat is added:-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=trueOrg.apache.catalina.startup.Bootstrap"[email protected]"Start>>"$CATALINA _base"/logs/catalina.out2>&1&if[!-Z"$CATALINA _pid"]; ThenEcho$! > $CATALINA _pidfiFielif [" $"="Stop"] ; Then
Location 2:java_opts= "Xxx-djava.awt.headless=true"
Once saved, the graphics can be processed by restarting.
Java is not able to handle graphics solutions under Linux