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

Solaris Java Problem

Muhammad Zaheer Ahmad

Joined: Dec 22, 2008
Posts: 7

Hello All,
I am facing a problem with Solaris.
I create a buffered Image and trying to make it render my cpatcha text data.Every thing goes fine on window, but when i deploy application on solaris it gives error. for creatingGraphics

CODE: for jdk1.3

BufferedImage image = new BufferedImage(width, height,BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D graphics2D = image.createGraphics();

at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(
at java.awt.image.BufferedImage.createGraphics(
at T_00033.jsp.n_00025wsletter._0002fT_00033_0002fjsp_0002fnewsletter_0002fkaptcha_0002ejspkaptcha_jsp_7._jspService(
at org.apache.jasper.runtime.HttpJspBase.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(
at org.apache.jasper.runtime.JspServlet.serviceJspFile(
at org.apache.jasper.runtime.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at com.broadvision.servlet.ServletContainer.service(
at com.broadvision.servlet.ServletContainer.processRequest(
at com.broadvision.servlet.ServletContextContainer.processRequest(
at com.broadvision.servlet.BVServletEngine.service(
at com.broadvision.servlet.BVServletConnector.service(

I found it that its a bug for non windows os to createGraphics for them but there must be an other way to do this.
I just want to createBuffer image using jdk1.3 and return it to jsp pages.
Can any body help who have solaris exp.

Thanks in advance
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


Welcome to JavaRanch!

Servers on UNIX machines are generally running without access to an X/Windows display, so attempting to initialize the graphics system leads to an error -- as you've found. This FAQ page mentions the issue.

One problem is that the java.awt.headless system property that provides an easy solution to this wasn't introduced until JDK 1.4; why are you running such an old JVM?

I'm going to move this to our Tomcat forum; this isn't an advanced Java programming question.

[Jess in Action][AskingGoodQuestions]
Muhammad Zaheer Ahmad

Joined: Dec 22, 2008
Posts: 7

Thanks for your reply,
the points you mentioned are valid but, infect i cant use all of those.
I have to make change in an existing application which is built using jdk1.3
and also i cant do more with server like installing VNC based new OS or other utilities which provide graphics operations like in windows.
Is there any JAVA API for images creation which does not require that OS has GUI or not but can provide image creation operations.
I think images can be created with out any native OS support.
If any one knows some tricks or tips will be helpful.

I agree. Here's the link:
subject: Solaris Java Problem
jQuery in Action, 3rd edition