File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes show buffered image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "show buffered image" Watch "show buffered image" New topic

show buffered image

matthias maneck

Joined: Jun 28, 2004
Posts: 2
i create a buffered im age with the help of a servlet and show it on a jsp.

i have installed jdk 1.4.2 and tomcat 4.1 under windows...

if i run the web-application with the tomcat serven on my system everything is fine.

if i run it ou an external server tomcat 4.1 with jre 1.4.2_02 und er linux
the following error occurs when the image should appear:

at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(
at java.awt.image.BufferedImage.createGraphics(
at gelcali.DrawGel.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(

is it not possible to run the server under linux with jre and show buffered images?


p.s.: i create the buffered image by the following way:

BufferedImage image = new BufferedImage(450, 450,

DrawGel line 70 --> Graphics2D graphic = image.createGraphics();
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Many of the operations in the java.awt package rely on native support - ie they tie into the underlying operating system. I've run into this problem before where the linux installation doesn't have any graphics support (ie 'headless'), typically with the error "Can't connect to X11 window server"

But there is a work around - here is an api called PJA (Pure Java AWT) which implements the required graphics support with a purely Java implementation. I still had some problems that I didn't end up fixing - like using Fonts - but all I was doing was simple graphics conversion, and this worked fine.

Hope this is what you were looking for.

I agree. Here's the link:
subject: show buffered image
It's not a secret anymore!