• Post Reply Bookmark Topic Watch Topic
  • New Topic

show buffered image  RSS feed

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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(Class.java:141)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1041)
at gelcali.DrawGel.doGet(DrawGel.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

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();
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!