Java in Linux can not handle graphics solutions to share _java

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.