On Fri, 22 Jan 1999, Michael Sinz wrote:

> On Fri, 22 Jan 1999 11:24:40 -0500, Warren Johnson wrote:
> 
> >I have a web page that can be accessed with a browser (IE4 and Netscape)
> >called Build the Snowman. On the left frame  is the beginning template of
> >the snowman on the right frame is stuff like clothes, hats, etc... On the
> >bottom you hit a button which then calls a cgi program sitting on the Redhat
> >5.2 server. In that cgi program, the image is transferred over to java to be
> >merged as one picture. After that I guess it's thrown back to the cgi
> >program to replace the image on the left side as the finished project.

> Well, the issue is that the graphics toolkit needs motif which needs
> the X server (for things like image depth and format)  Why there is no
> easy way to do this in the default Unix JDK is beyond me, but that is
> how it works.
> 
> I too noticed that doing graphics manipulation code requires an X Server
> so it is hard to use Java for such things on a console-only system.

Yes, that's exactly what's going on.  The program is probably trying to
create an Image object and then getting its graphics context to draw on
it.  In order to get it working, you will have to start up the X server on
the web server machine and leave it up.

> Maybe someone knows a workaround to this (or a nice trick?)

I *believe* that jdk 1.2 allows you to create Images without resorting to
X, with the 2d API, but I haven't tried it myself yet.

The workaround for 1.1 is to create an array of pixels, draw on them
yourself and get a GIF encoder (I used one called Acme) to convert it for
the web.  It's easy to draw vertical/horizontal lines & boxes, but for
other figures you have to code some graphics algorithms yourself.

. . . Sean.

Reply via email to