Answer the question
In order to leave comments, you need to log in
How can I move the mouse?
I have a laravel project on my server (amazon ec2)
and this java code
import java.awt.event.MouseEvent;
import java.awt.*;
public class Run {
private static Robot robot = null;
public static void main(String[] args)
{
System.out.println("Hi");
try{
robot = new Robot();
}catch (AWTException e){
e.printStackTrace();
}
klick(250,410);
}
public static void klick(int x, int y)
{
robot.mouseMove(x,y);
}
}
Hi
java.awt.AWTException: headless environment
at java.awt.Robot.<init>(Robot.java:91)
at Run.main(Run.java:15)
Exception in thread "main" java.lang.NullPointerException
at Run.klick(Run.java:25)
at Run.main(Run.java:20)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question