I created java file in IntelliJ IDE, with that code
import java.awt.AWTException;
import java.awt.MouseInfo;
import java.awt.Robot;
public class JavaRobotExample {
public static void main(String[] args) {
int x = 12,
y = 300;
try {
Robot robot = new Robot();
robot.mouseMove(x, y);
int xAct = (int) MouseInfo.getPointerInfo().getLocation().getX(),
yAct = (int) MouseInfo.getPointerInfo().getLocation().getY();
String sPred = String.format("Predicted mouse location : %, d, %, d", x, y),
sAct = String.format("Actual mouse location : %, d, %, d", xAct, yAct);
System.out.println(sPred);
System.out.println(sAct);
} catch (AWTException e) {
e.printStackTrace();
}
}
}
That example works fine in Windows 7 environment, but the same code on Mac OS 10.14 doesn't move mouse using method mouseMove (but reads position with MouseInfo class).
Also I don't receive any Exception e.g.
Did someone had earlier similar problem? Any ideas how to get that code to work in Mac OS?
Best Regards,