I develop a Java application that must be able to see the screen for automation purposes.
I used to use the Robot Class in java to take screenshots and look for pixel Colors, however it stopped working at some point. I googled around for an hour and only found random comments speculating that it’s a security feature of Wayland or Xorg.
However I know an alternative must exist becuase other applications (Like Spectacle and Discord) are clearly still able to take screenshots. Does anyone know an alternative to the Robot Class in Java or have more information regarding this issue?
It is especially annoying since it just outright crashes the application so it took some time to debug the issue by slowly removing code until I found the guilty function call.
I use java-14-openjdk and Intellij idea and call createScreenCapture function on a Robot object, that should make it reproduceable. It is possible that it is a Bug in java-14-openjdk, please let me know and I will remove the post. Since java 14 is supported by Arch I thought it might also be the case for Manjaro, please correct me if im wrong.