Robot doesn't move mouse in Java on Chromebook

43 views Asked by At

Why doesn't the below code work for moving the mouse on a Chromebook?

import java.awt.Robot;
import java.awt.AWTException;

public class MoveMouse {
   public static void main(String[] args) throws AWTException, InterruptedException {
      Robot robot = new Robot();
      robot.mouseMove(0, 0);
      Thread.sleep(1000); // Add a 1-second delay
   }
}

No compile errors, and the program does sleep for a second. However, the mouse doesn't move.

0

There are 0 answers