0

I am working on a project on the comparatively slow Raspberry Pi system. I run the rpix86 DOS emulator in basic console mode (without X!) to maximize its speed.

I need to take screenshots (640x480) from it. My java implementation throws "AWTException: headless environment".

            BufferedImage image = null;
        try {
            image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
            ImageIO.write(image, "png", new File("/screenshot + i" + ".png"));

        } catch 

Or, if I try

static { System.setProperty("java.awt.headless", "false"); }

then I get

java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable

Is it even possible to take screenshots with Java in the headless environment, or am I trying the impossible?

Thanks in advance! Theo

eltabo
  • 3,749
  • 1
  • 21
  • 33
Theo H.
  • 141
  • 1
  • 3
  • 8
  • Given that there is no screen, what do you expect the "screenshot" to contain? If we knew that, we might be able to help you figure out a way to capture it. – jpmc26 Feb 07 '14 at 03:20

1 Answers1

0

Not exactly sure... If it is "headless" than your best bet would be to save the output of your commands to a text file that you can print or save accordingly.

If it is a DOS command-line, the "[command here] > outputfile.txt" should pipe your commands to a text file. Hope that helps.

PSeUdocode
  • 412
  • 1
  • 4
  • 10