Java calls a local image processing library during graph processing. When using Java for graphic processing (for example, image scaling, image signature, and report generation), there is no problem if the program runs on Windows. If the program is transplanted to Linux/Unix, the image cannot be displayed.
Tip: "can't connect to X11 window server". This is because an X server is required for graph processing in Linux.
Solution:
1. If a graphical interface is installed on the server, you can set the environment variable dispaly = 127.0.0.1: 0.0.
2. If the graphic interface is not installed, you can add the parameter-djava. AWT. Headless = true during Java runtime.
3. Use the PJA library instead of the local image processing library.
Modify Tomcat as follows:
Open the % tomcat_home %/bin/Catalina. Sh file in-djava. Io. tmpdir = "$ catalina_tmpdir" and add-djava. AWT. Headless = true to the Tomcat STARTUP script.
"$ _ 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 ["$1" = "stop"]; then
After the image is saved, restart the system to process the image.