Jfreechart charts are not displayed when running on Linux

Source: Internet
Author: User
Jfreechart charts run normally on windows, but an error occurs in Linux as follows:
Java. Lang. internalerror: Can't connect to X11 window server using ': 0.0' as the value of the display variable.
At sun. AWT. x11graphicsenvironment. initdisplay (native method)
At sun. AWT. x11graphicsenvironment. <clinit> (x11graphicsenvironment. Java: 134)

Check it online:
"This error is caused by a chart.ProgramAWT is implemented through AWT. AWT will call the drawing of the local window resource of the operating system. Windows supports this very well. in Linux, AWT cannot draw if it does not enter the X Window"

Solution:
[Root @ localhost logs] # export display =: 0
[Root @ localhost logs] # source/etc/profile
[Root @ localhost logs] # env
See
Display =: 0
Set OK. Restart the Tomcat service.

---------------------------------------------------------
I have not verified the practices of some netizens:
Jasper is installed in windows and runs normally, but an error occurs in Linux: Java. lang. internalerror: Can't connect to X11 window server using ': 100' as the value of the display variable.
Solution:
Add-djava. AWT. Headless = true to JVM
For tomcat, you can modify Catalina. SH and add catalina_opts = "$ catalina_opts-djava. AWT. Headless = true"

For example:
......
Elif ["" = "start"]; then

Shift
Touch "$ catalina_base"/logs/Catalina. Out
Catalina_opts = "$ catalina_opts-djava. AWT. Headless = true" # Add this row in the Catalina. Sh file (240 rows later)
If ["" = "-Security"]; then
Echo "using security manager"
Shift
.....

======================================
Official solution: http://www.jfree.org/jfreechart/faq.html#FAQ10

See:

Http://www.cnflex.org/bbs/archiver? Tid-1.html

A Linux User wants to install a xorg-x11-deprecated-libs package (Fedora) with a similar support package to avoid the following errors:
Java. Lang. unsatisfiedlinkerror:/opt/j2sdk1.4.2 _ 11/JRE/lib/i386/libawt. So: libxp. so.6: cannot open shared object file: no such file or directory

View package information with rpm-Q xorg-x11-deprecated-libs commands

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.