I had this problem some time ago too in a different context so I pointed the Unix server's display to a remote X11 server and it worked fine. I also saw people installing a minimal X11 server that didn't do anything (I can't remember the name of that though).
d. Mike Duffy wrote: > Christopher, > > Thank you for a very informative reply. > > I have another question that I hope you will be able to answer. > > PJA is one of the replacement toolkits: "100% Pure Java and doesn't > use any native graphics resource". According to their website > (http://www.eteks.com/pja/en/), "When no X11 Display is available on > a UNIX machine (also called headless environment) or when GDI > resources are low on Windows, it is impossible to compute off-screen > images with java.awt.Graphics methods under a JDK version < 1.4, even > if your program doesn't need to display these images. Typically, this > situation happens for servlets returning dynamically generated images > like pies, charts or web counters." > > I also read through the information from Sun > (docs/guide/awt/AWTChanges.html) > > Am I correct in assuming that if I run J2SE 1.4 with > "-Djava.awt.headless=true", native graphics resource will not be used > and I will get a pure Java implementation just as if I was running > one of the replacement toolkits? > > Thanks. > > Mike > > > --- "Christopher K. St. John" <[EMAIL PROTECTED]> wrote: > >>Mike Duffy wrote: >> >>>Is there a problem using running AWT classes on an >>>application server? >>> >>> >> I'm assuming you mean using the AWT in headless mode >>by setting "-Djava.awt.headless=true"? It works, but >>you can't use most of the heavyweight components, >>like Frames. You'll get an "java.awt.HeadlessException" >>You can use code like this, though: >> >> BufferedImage bi = new >>BufferedImage(128,128,BufferedImage.TYPE_INT_RGB); >> Graphics2D g = bi.createGraphics(); >> g.drawLine(0, 0, 120, 120); >> Raster r = bi.getData(); >> rsp.setContentType("image/jpeg"); >> JPEGImageEncoder ie = >>JPEGCodec.createJPEGEncoder(rsp.getOutputStream()); >> ie.encode(bi); >> >> where "rsp" is the servlet response argument in doGet() >>or doPost(). There's documentation in the JDK 1.4 >>doc bundle: >> >> docs/guide/awt/AWTChanges.html >> >> If you're stuck with legacy code that uses heavyweight >>components, you'll still need to run xvfb or use one >>of the AWT replacement toolkits (check the list archives >>for details, a search on "xvfb" will get you the >>relevant threads) >> >> Or do you mean something completely different? >> >> >>-- >>Christopher St. John [EMAIL PROTECTED] >>DistribuTopia http://www.distributopia.com >> >> >> > ___________________________________________________________________________ > >>To unsubscribe, send email to [EMAIL PROTECTED] and include in >>the body >>of the message "signoff SERVLET-INTEREST". >> >>Archives: >>http://archives.java.sun.com/archives/servlet-interest.html >>Resources: >>http://java.sun.com/products/servlet/external-resources.html >>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html >> >> > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ > > ___________________________________________________________________________ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > > > > -- David Mossakowski [EMAIL PROTECTED] Instinet Corporation 212.310.7275 ******************************************************************************* <<Disclaimer>> This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and/or CONFIDENTIAL or both. This email is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this email is not an intended recipient, you have received this email in error and any review, dissemination, distribution or copying is strictly prohibited. If you have received this email in error, please notify the sender immediately by return mail and permanently deleting the copy you received. Thank you. ******************************************************************************* ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
