Where does 'import java.awt.Robot;' import from?

I'd like to experiment with this Java class, but on searching for 'java.awt' and awt.Robot on my HD (Jre 7.45 installed,) I get 'no items match this search'.

Aside from adding the text in the title into my code, is there another step(s) missing in the process of importing the robot class into processing? Where is jave.awt.Robot? Do I need to update Java?




  • Install Java JDK, not JRE. Look for "src.zip" in the installed folder for all source code.

  • Ahh! Will do. For 64 bit win7 I need jdk x64, yes?

  • The answer of GoToLoop is a bit ambiguous.
    The Robot class is in the JRE as well. But you won't find it the way you search it (I think, I am not sure what you are doing, actually!).
    Here, GoToLoop's advice is to get the source code of Java to locate the class.

    More concrete answers:

    • Java 32-bit works fine on Windows 64-bit.
    • To see if you can use java.awt.Robot, just import it and use it...
  • edited July 2015

    import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; import java.io.IOException;

    public class RobotSample {

    public static void main(String[] args) throws IOException {

    try { Robot robot = new Robot(); Runtime runtime = Runtime.getRuntime(); runtime.exec("D:\Program Files\Mozilla Firefox\firefox.exe"); robot.delay(1000); robot.keyPress(KeyEvent.VK_F6); robot.keyPress(KeyEvent.VK_DELETE); robot.keyPress(KeyEvent.VK_T); robot.keyPress(KeyEvent.VK_W); robot.keyPress(KeyEvent.VK_I); robot.keyPress(KeyEvent.VK_T); robot.delay(70); robot.keyPress(KeyEvent.VK_T); robot.keyPress(KeyEvent.VK_E); robot.keyPress(KeyEvent.VK_R); robot.keyPress(KeyEvent.VK_DECIMAL); robot.keyPress(KeyEvent.VK_C); robot.keyPress(KeyEvent.VK_O); robot.keyPress(KeyEvent.VK_M); robot.keyPress(KeyEvent.VK_ENTER); robot.delay(200); } catch (AWTException e) { e.printStackTrace(); } } }

  • Thanks PhiLho. designbyrj- I have no idea what your code does!

Sign In or Register to comment.