NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: Problem with off-screen render

Thanks, Ugo. I was not aware that you could specify a headless environment that way. I think this is the right way to go, because ultimately, I want to create images
using VisAD within a servlet, and servlets are headless.

I added -Djava.awt.headless=true to the invocation of the java VM
when I ran my test program.
I now get a InitializerException thrown from DisplayImplJ3D.initialize() because
VisADConfig.makeConfig calls getDefaultScreenDevice() which throws
a java.awt.HeadlessException.
I'm thinking that:
(a) if I'm creating an offscreen DisplayImplJ3D, it should not be asking for a default screen device.
or (b) DisplayImplJ3D.initialize() should gracefully handle a headless case.

Lak



Ugo Taddei wrote:

Hello listeners,

I'm not sure if this will help, but here we go:

The java.awt.headless property (since JDK 1.4.2) can perhaps be used. I quote:

Q: "...I find that when I run my application on Solaris or Linux it needs an Xserver.(...)"

A: "There are two possible solutions. For releases prior to 1.4 you can provide a "pseudo X-server" to emulate a display environment One of these X-server emulators is Xvfb, available for download at www.x.org.

The preferred solution for release 1.4 and later is to use the new headless AWT toolkit <http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless>. This new feature allows you to use the J2SE API in a server-side Java application without requiring you to have a GUI environment.

To specify the headless environment when using Sun Microsystem's reference implementation, run your application with this property:

-Djava.awt.headless=true
[http://java.sun.com/products/java-media/2D/forDevelopers/java2dfaq.html]

Never did this with VisAD, but it might work. Well, it's a nice thing to know anyway.

Cheers,

Ugo

Valliappa Lakshmanan wrote:


If I create a JFrame and make it visible, then the off-screen
render works, i.e. if I add these two lines before the getImage(true) call:
   new javax.swing.JFrame().setVisible(true);
then, the program runs to completion.

Does VisAD *require* a visible component
in order to do an off-screen render?

Lak




  • 2004 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: