File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

show buffered image

 
matthias maneck
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
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:

java.lang.NoClassDefFoundError
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)

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

thanks
matthias

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

BufferedImage image = new BufferedImage(450, 450,
BufferedImage.TYPE_INT_RGB);

DrawGel line 70 --> Graphics2D graphic = image.createGraphics();
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • 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.

Dave
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic