Java can not handle graphics solutions under Linux

  
Java calls the local graphics processing library during graphics processing. When using Java for graphics processing (such as: image scaling, image signature, report generation), there will be no problem if running on windows. If you port the program to Linux/Unix, there may be errors that the graphics cannot display. Tip: "Can't connect to X11 window server" This is due to the need for an X Server server for Linux graphics processing. Solution: 1. If a graphical interface is installed on the server, it can be solved by setting the environment variable: DISPALY=127.0.0.1:0.0. 2. If the graphical interface is not installed, you can add the parameter to the Java runtime: -Djava.awt.headless=true. 3. Use the PJA library instead of the local graphics processing library. The Tomcat changes are as follows: Open the %Tomcat_home%/bin/catalina.sh file at 86% of the file, and start the Tomcat script with: -Djava.awt.headless=true \\ Reference:
"$_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" ]; thenecho $! > $CATALINA_PID fifielif [ "$1" = "stop" ] ; then after saving, the graphics can be processed by rebooting. 

Copyright © Windows knowledge All Rights Reserved