Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8958387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:12:06+00:00 2026-06-15T15:12:06+00:00

So, I was was tinkering around with the Robot Class in Java. I am

  • 0

So, I was was tinkering around with the Robot Class in Java. I am a very new Java Programmer, but I have deeper roots in other languages. Here’s my code:

import java.awt.*;

public class Main {

    public static void main(String[] args) {
        Robot bot = new Robot();
        bot.mouseMove(50, 50);  
    }
}

All I was trying to do was see if I can control the mouse, as in, moving it to 50, 50. However, in Eclipse it puts a red X next to

Robot bot = new Robot();

..saying..

Unhandled exception type AWTException

And won’t let me run it. Can anyone help me figure out why this is happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:12:08+00:00Added an answer on June 15, 2026 at 3:12 pm

    you need to try/catch exceptions:

    import java.awt.*;
    public class Main{
    
    public static void main(String[] args) {
    
        try
        {
        Robot bot = new Robot();
        bot.mouseMove(50, 50);  
        }
        catch (AWTException e)
        {
        e.printStackTrace();
        }
    }
    }
    

    or throw the exception:

    import java.awt.*;
    public class Main throws AWTException{
    
    public static void main(String[] args) {
        Robot bot = new Robot();
        bot.mouseMove(50, 50);  
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a relatively new java programmer and I've been tinkering around with this program
I'm new to HTML5/Canvas/Game programming, but have been tinkering around with it after reading
I am completely new to Batch files and have been tinkering around with simple
Here lately I've been tinkering around with my own languages as well as reading
I have been tinkering around with ServiceStack to expose some web services and have
A buddy of mine is currently tinkering around with JpCap in Java and we
I've been tinkering around with Flex RemoteObjects, and I've found that they aren't very
I am tinkering around with jQuery and am finding it very useful and almost
I'm tinkering around with tkinter, and have used it to make some dynamic graphics
I'm currently tinkering around with Workflow Foundation. I have an activity which contains the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.