[fedora-java] Graph APIs does not work on Linux Server.

Robert Marcano robert at marcanoonline.com
Mon Sep 14 06:03:05 UTC 2009


On 09/14/2009 01:10 AM, sj david wrote:
> Hi Fedora,

Hello David
...
>
>       I Setup the Eclipse IDE & Tomcat server on Fedora 9. I am facing
> following problems while enabling graphical APIs on the application:
> *1*. I have a running java application with JCharts on Windows which
> works fine with Eclipse & Tomcat server. But when I am  trying to deploy
> the same on Fedora 9. JCharts are not able to render & I am getting the
> following error:
>      : "/*Gtk Warning: cannot open display*/".

First, it is time to move from Fedora 9, it is not supported anymore :-)

Now the problem could be that the Tomcat server is running under a user 
with no access to the display and that is the correct way to install it. 
JFreeChart uses a lot Java2D, that until Java 1.4 required to have 
access to a display (in Linux a X Server), but Sun introduced a in 1.4 
the System property java.awt.headless that make it possible to use 
Java2D and many other graphic related classes/methods.

You need to add the argument -Djava.awt.headless=true to the script that 
start Tomcat, when calling the java executable

> If I disable the call to JCharts APIs, My application works fine. Can
> you please help me here.
>
> *2*. To overcome this issue, I move to another Chart API: JFreeCharts. I
> added the jar in the classpath & also added its java files in the
> project, but whenever I am running my application from Eclipse with
> Tomcat, Tomcat is not able to  load this JFreeChart class files, saying :
>
> *java.lang.NoClassDefFoundError*
>
> . Please help me here.
>
>
> Thanks
> David.
>
>
> ------------------------------------------------------------------------
>
> --
> fedora-devel-java-list mailing list
> fedora-devel-java-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-devel-java-list




More information about the java-devel mailing list