Robbie Baldock wrote:
>
> Nathan Meyers wrote:
>
> > You're probably looking for Xvfb - an X server whose "device" is a
> > memory buffer. It looks and acts like an X server because it is one...
> > without needing a display. Available wherever XFree86 is sold -
> > the RPM is XFree86-Xvfb, if you're an RPM user.
>
> That sounds good. But how would I make my Java app run in this
> environment? Should I call Runtime.exec("Xvfb") from within Java or
> should it be called by the Perl CGI script before the Java app is
> called?
What has to happen is:
1) The X server must be up and running before Java tries to talk to it,
and
2) The DISPLAY variable seen by Java must point to the X server.
Here's a possible (but problematic) CGI script:
Xvfb :0 &
PID=$! # Remember X server PID
export DISPLAY=:0.0
java ....
kill $PID
The problems?
1) Very expensive to start all this stuff up every time you need to do
CGI.
2) Only one server can run at a time for a given display address (:0,
:1, etc.); you'll have problems with two simultaneous requests.
The solutions?
1) Have the Xvfb running all the time, rather than startup/shutdown from
your CGI. Or you could not kill it and let the Xvfb invocation succeed
iff a server is not already running.
2) If you can find a way to support servlets in your web server, you'll
see a drastic speed improvement over having to exec a java interpreter
for every request.
Nathan
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]