-
Bug
-
Resolution: Other
-
P4
-
None
-
9
-
None
-
linux
Steps to reproduce:
- Install Ubuntu 14.04 on VirtualBox
- Install VirtualBox Guest Additions
- Install JDK 9
- Run the program:
---------------------------
import java.io.File;
import javax.imageio.ImageIO;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
public class ScreenCaptureTest {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
throw new RuntimeException("Image save path is not specified!");
}
Robot robot = new Robot();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
BufferedImage image = robot.createScreenCapture(new Rectangle(screenSize));
ImageIO.write(image, "png", new File(args[0], "screenshot.png"));
}
}
---------------------------
The saved image is either black or only desktop background is saved.
- Install Ubuntu 14.04 on VirtualBox
- Install VirtualBox Guest Additions
- Install JDK 9
- Run the program:
---------------------------
import java.io.File;
import javax.imageio.ImageIO;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
public class ScreenCaptureTest {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
throw new RuntimeException("Image save path is not specified!");
}
Robot robot = new Robot();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
BufferedImage image = robot.createScreenCapture(new Rectangle(screenSize));
ImageIO.write(image, "png", new File(args[0], "screenshot.png"));
}
}
---------------------------
The saved image is either black or only desktop background is saved.