Can someone help !? I have created code to generate JFreeChart charts for a while now, using custom code in a standalone application - fantastic results - then I embed the chart images into a pdf using a pdf library.
Now, I need to run the same java code (very complex) in a servlet and generate *exactly* the same chart images - but i suddenly find that JFreeChart charts need the "AWT" to generate images into a "BufferedImage" object, and the "imageio" library to export to a "PNG" - none of this AWT stuff runs in a web server, so how can I create the chart *without* the "awt" (the code is custom, intricate, and complex and must run inside a servlet - *cannot* use "cewolf") ??? Can anyone help?
Run JFreeChart in a Web Server
I don't see why you can't use awt in the web server, if you use a BufferedImage, then you can encode as JPEG/ PNG and put on the response output stream.
If your using Unix/Linux then you'll need set the headless parameter i.e for tomcat set the property via :-
export CATALINA_OPTS="-Djava.awt.headless=true"'.
I've used a similar process in the past.
Jason.
If your using Unix/Linux then you'll need set the headless parameter i.e for tomcat set the property via :-
export CATALINA_OPTS="-Djava.awt.headless=true"'.
I've used a similar process in the past.
Jason.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
This is a general issue with the way Sun has implemented Java on Unix-like systems. See item 10 in the FAQ:
http://www.jfree.org/phpBB2/viewtopic.php?t=8420
http://www.jfree.org/phpBB2/viewtopic.php?t=8420
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

