If you type the following before the java command in your terminal, does the java command succeed?

Xvfb :100 -ac
export DISPLAY=100.0

If it does, then your server code needs to do the following before generating a PNG:
1) check if Xvfb is running and if not, start up a new process
2) set DISPLAY to 100.0

Regarding your questions,

1) I don't quite understand. The only way to generate an image is using a command similar to the one you have supplied. Would you like to have the images output to stdout instead to avoid writing them to disk? This would be pretty easy to add.

2a) It should be possible for perl to construct command lines similar to the one you have supplied and to generate PNG images that can be served to the client.

2b) It is not possible for java treeview to provide an interactive experience through a perl web application.

2c) However, you could run java treeview as an applet. The perl web application could create a .cdt file on disk, and then serve a page with the applet pointing at that new url. You can see the applet in action here:

http://jtreeview.sourceforge.net/examples/applets.html

Hope this helps,
Alok

On Thu, Feb 24, 2011 at 8:47 AM, brajendra kumar <brajbio.22@gmail.com> wrote:
Hi Alok,

Thank you for your quick response.

I believe i did not convey the Treeview issue precisely in last mail.

Requirement

The plan is to integrate the Tree viewer in to our web application (cgi-perl).
so as to
- generate a dendogram from *.cdt file (generated from Cluster 3.0) in the backend (linux),  - create a *.png file and
- finally display the image to the end-user via our front-end

Currently, I run the command "java -jar TreeView.jar -r ~/Hclust_NGS/dlcl.cdt -x Dendrogram -- -o ./braj_image.png -s 10x1 -a 0 -c 1" from my terminal and it fails with DISPLAY not set error "(.:22914): Gtk-WARNING **: cannot open display:"

1. Is there any possibility of generating a PNG without 'export' option from the command line?

2. Can  treeview browser be integrated to perl code so that end-user can view the treeview browser as part of our web application?



Regards,
Brajendra Kumar






On 23 February 2011 22:07, Alok Saldanha <alokito@users.sourceforge.net> wrote:
I'm using AWT to render the image, and it most likely needs an x server on linux. I recommend running XVFB. Try doing the following before you run java:

Xvfb :100 -ac
export DISPLAY=100.0

Best,
Alok


On Wed, Feb 23, 2011 at 8:15 AM, brajendra kumar <brajbio.22@gmail.com> wrote:
Hi Alok,

I had downloaded the "TreeView-1.1.5r2-bin.tar.gz" file and want to run it from command line on my centos x86_64 server with
 java version "1.4.2" and gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-44)

But while executing the command i am getting the error as below

###################################################
-bash-3.1$ cd TreeView-1.1.5r2-bin
-bash-3.1$ ll
total 364
drwxr-xr-x 2 brajcn brajcn   4096 Jun 26  2010 coordinates
-rw-r--r-- 1 brajcn brajcn  18009 Jun 26  2010 gpl.txt
drwxr-xr-x 2 brajcn brajcn   4096 Jun 26  2010 images
drwxr-xr-x 2 brajcn brajcn   4096 Jun 26  2010 lib
drwxr-xr-x 2 brajcn brajcn   4096 Jun 26  2010 META-INF
drwxr-xr-x 2 brajcn brajcn   4096 Jun 26  2010 plugins
-rw-r--r-- 1 brajcn brajcn 322184 Jun 26  2010 TreeView.jar
-rw-r--r-- 1 brajcn brajcn     32 Jun 26  2010 win32TreeView.bat
-bash-3.1$ java -jar -Xmx500m TreeView.jar
File not found, will try from URL
Making new configuration file /home/brajcn/.javaTreeViewXmlrc
Plugin Jar jar:file:/home/brajcn/Hclust_NGS/JtreeView/TreeView-1.1.5r2-bin/./plugins/Dendrogram.jar!/

(.:15569): Gtk-WARNING **: cannot open display:


-bash-3.1$ java -jar TreeView.jar -r ~/Hclust_NGS/dlcl.cdt -x Dendrogram -- -o ./braj_image.png -s 10x1 -a 0 -c 1
File not found, will try from URL
Making new configuration file /home/brajcn/.javaTreeViewXmlrc
Plugin Jar jar:file:/home/brajcn/Hclust_NGS/JtreeView/TreeView-1.1.5r2-bin/./plugins/Dendrogram.jar!/

(.:15631): Gtk-WARNING **: cannot open display:
-bash-3.1$

####################################################################################



My purpose is just to create the .png from the *.cdt file.


I wonder the same commands are working on my local machine with Linux(fedora) GUI.

Can you help me resolving the error i am getting on server, so that i can successfully create the deprogram image.

I will greatly appreciate your response in this concern.


Thanks,
Brajendra Kumar
+91-9884859121

India