Hello,

I think I've found a better workaround than logging in and starting an X
server so the JVM as access to an X display.

The VNC software (Virtual Network Computing) from Olivetti Research
Laboratory recently acquired by AT&T Laboratories, U.K. is a virtual X
server that functions in a manner similar to pcANYWHERE on PC's.  Servers
are available on Solaris, Linux and NT among others.  Clients or viewers are
available on various platforms and in additon via a Java applet!  However,
for this purpose, you don't need a viewer unless you are just curious.

Go to http://www.uk.research.att.com/vnc/ and download the VNC server for
your platform.  Linux RPM's can be found at
http://rpmfind.net/linux/RPM/vnc.html.

Create a javax script like this:

#!/bin/sh
# javax - runs vncserver with java so JVM has access to an X display for
images
dis=":1"  # default display
DISPLAY="${dis}.0"; export DISPLAY
vncserver $dis
java $*
vncserver -kill $dis

Now configure your servlet environment to start this javax script instead of
java and restart.

How does it work?  The vncserver command starts an X server (Xvnc) using :1
as the display.  DISPLAY is set to use :1.0 so the java command has a valid
X display.  When the java command exits, the server is shut down with the
-kill option.

If anyone tries this, please let the list know if this solution works (or
not).

-Bill

David Wall wrote:
>
> I run them under Linux, and I have found that the web server needs to have X
> running, and in fact, there must be someone logged on to X so that the
> DISPLAY=:0.0 will be available and usable.
>
> It's a bit odd, but even if the image generation will NOT display the image,
> Java (blackdown jdk 1.1.7) will not return things like Graphics to draw the
> image on unless you have either displayed the Frame (or better by calling
> addNotify() to get the peers created without actually displaying
> anything) -- via frame.setVisible(true); frame.setVisible(false); -- and you
> can't do these without having the display available.
>
> But, I'd sure like to know if anybody has solved this better.  As it is
> right now, whenever my web server is rebooted, I must login (to any X
> account) via xdm to allow the DISPLAY to work.
>
> David
>
> >I know that many of you have experience using dynamically generated
> >images from servlets on Solaris/UNIX hosts and was wondering if anybody
> >had an answer to a recurring problem of mine. I have a servlet that
> >generates an image and serves it back to the client.  I'm trying to
> >explain to an ISP how to set up their system for image generation.  My
> >questions are:
> >
> >What software has to be installed on the Web server?
> >What system environment variables have to be set?
> >What has to be running on the Web server to make it all work?
>

--
Bill Burton, Senior Internet Software Engineer, Progress Software
Corporation
[EMAIL PROTECTED]
http://apptivity.progress.com/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to