Package: openjdk-11-jdk
Version: 11.0.5+10-1~deb10u1
Severity: normal
Tags: upstream
Dear Maintainer,
java.awt.Robot fails to capture the screen if wayland is used. (which is the
default in Debian Buster)
Code to reproduce:
public void captureScreen() throws AWTException {
Robot robot = new
Robot(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
BufferedImage screen = robot.createScreenCapture(new
Rectangle(getDefaultToolkit().getScreenSize()));
try {
ImageIO.write(screen, "jpg", new File("/tmp/screenshot.jpg"));
} catch (IOException e) {
e.printStackTrace();
}
}
Or install the remote desktop tool from
https://github.com/RetGal/Dayon/releases/download/v1.9.1/dayon_1.9.1_all.deb
and run both, assistant and assisted on the same system running Debian Buster
with default Gnome-Wayland desktop.
The same code works as soon either Oracle JDK or Xorg.X11 is used.
I already addressed this issue to the Wayland developpers, here is what they
said:
This is not a Wayland bug, this is a problem with java.awt.Robot. Report it to
the proper place. Let them know that they can take screenshots with dbus or
with wlr-screencopy, depending on the wayland compositor in question.
(https://gitlab.freedesktop.org/wayland/wayland/issues/130)
-- System Information:
Debian Release: 10.2
APT prefers stable
APT policy: (990, 'stable'), (500, 'stable-updates')
Architecture: amd64 (x86_64)
Kernel: Linux 4.19.0-6-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_CH.UTF-8, LC_CTYPE=de_CH.UTF-8 (charmap=UTF-8),
LANGUAGE=de_CH.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages openjdk-11-jdk depends on:
ii libc6 2.28-10
ii openjdk-11-jdk-headless 11.0.5+10-1~deb10u1
ii openjdk-11-jre 11.0.5+10-1~deb10u1
ii zlib1g 1:1.2.11.dfsg-1
Versions of packages openjdk-11-jdk recommends:
ii libxt-dev 1:1.1.5-1+b3
Versions of packages openjdk-11-jdk suggests:
pn openjdk-11-demo <none>
pn openjdk-11-source <none>
pn visualvm <none>
-- no debconf information