JFreeCharts fails on Linux ????

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Awais Bajwa

JFreeCharts fails on Linux ????

Post by Awais Bajwa » Fri Sep 27, 2002 12:13 pm

Hello David/All,
I am very sad to know about the performence of JFreeCharts on Linux server ,as this liberary uses awt classes which requires Xwindows on Linux platform. On running a siple chart i am getting a weird exception saying ...as
Unalbe ot connect X11 '0.0 ' server .
sun.awt...........................................

I am surperised why JfreeCharts devlopers didnt use Swing for rendering the Graphics .?
Is there any way to solve this problem .
I am thinkng to modify some classes which use Awt and replace them to use wiht some Swing ones .
Any idea will be highly apprecieated ....

Best Regards .
Awais Bawja

Andreas Schroeder

Re: JFreeCharts fails on Linux ????

Post by Andreas Schroeder » Fri Sep 27, 2002 12:23 pm

Hi Awais,

have you read

http://www.object-refinery.com/phorum-3 ... 987&t=2987

?
Swing uses java.awt.Graphics2D Instances too, or am i wrong?
If it does, the problem will remain the same, even with swing.

Regards,

Andreas Schroeder

David Gilbert

Re: JFreeCharts fails on Linux ????

Post by David Gilbert » Fri Sep 27, 2002 3:11 pm

Andreas is correct. The problem isn't AWT vs Swing, or JFreeChart itself, but is due to the way graphics routines have been implemented in Java prior to JDK 1.4. And the link Andreas supplied summarises the solutions.

Regards,

DG.

Awais Bajwa

Re: JFreeCharts fails on Linux ????

Post by Awais Bajwa » Fri Sep 27, 2002 6:25 pm

Hello Andreas/David,

Thanks Andreas and David ,you both are correct . I have got the solution and Now JFreeCharts are running on my RH Linux 7.2 server .

Under JRE 1.4, setting the "headless" property to true allows JFreeChart to render charts in the absence of an X11 instance.
i did that using

*****************************************


System.setProperty("java.awt.headless","true");



*****************************************


For servlets, you can use set the property in the command line that invokes the servlet container:

java -Djava.awt.headless=true ...

In tomcat 4, the catalina.sh script can use an environment setting:

setenv CATALINA_OPTS -Djava.awt.headless=true




Regards
Awais Bajwa

Locked