I try to take screenshot from Java with CutyCapt in Linux. But for some reason when I run command from Java, it will not wait for CutyCapt to finish taking screenshot, instead it returns instantly and no screenshot is never taken.
This command works from command line, but not when run from Java.
xvfb-run --server-args="-screen 0, 1024x768x24" /usr/bin/cutycapt --url=http://www.google.com/ --out=/home/screenshots/screenshot1.png
Here is Java code that runs that command:
Process child = Runtime.getRuntime().exec(command);
child.waitFor();
EDIT:
I tried to get error message from command line and xvfb returns error message:
error: Xvfb failed to start
EDIT 2:
It worked when I removed --server-args from command, but what is wrong in my server args?