Nathan Geldner
Nathan Geldner

Reputation: 41

rookie issue: AWTException cannot be resolved to a type

I'm sorry for asking what is probably a very simple question, but my google-fu skills are failing me here. All I want to do is have a simple robot click around and type stuff.

here is the whole of my class thus far:

import java.awt.Robot;
    public class Geniebot extends Robot {
        public Robot bot;
        //this is the actual robot

        public Geniebot(){
            try{
                Robot r = new Robot();
            }
            catch (AWTException e){
                throw new RuntimeException("something is wrong");
            }
        }

}

and eclipse is underlining AWTException in red and saying that it cannot be resolved to a type.

Upvotes: 0

Views: 1273

Answers (1)

Raphaël
Raphaël

Reputation: 3726

You have to import java.awt.AWTException. Add it to your import list or use Ctrl + Shift + O to let Eclipse do it for you.

Upvotes: 2

Related Questions