Results 1 to 9 of 9
  1. #1
    jackbrr is offline Member
    Join Date
    Oct 2014
    Posts
    5
    Rep Power
    0

    Default Beginner and not understanding whats wrong

    Using the becker robots package and an error is coming up saying

    "C:\Users\USER\Documents\JCreator\GoRoundSquare.ja va:1: error: ';' expected
    import becker.robots*;
    ^
    1 error

    Process completed."

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default Re: Beginner and not understanding whats wrong

    Can you please post an MCVE?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    jackbrr is offline Member
    Join Date
    Oct 2014
    Posts
    5
    Rep Power
    0

    Default Re: Beginner and not understanding whats wrong

    Im very new to programming so if you could explain how that is done sure

  4. #4
    jackbrr is offline Member
    Join Date
    Oct 2014
    Posts
    5
    Rep Power
    0

    Default Re: Beginner and not understanding whats wrong

    "import becker.robots*;
    public class GoRoundSquare
    {
    public static void main(String[] args)
    {
    // Set up the initial situation
    City ny = new City();
    Robot karel = new Robot(ny, 0, 2, Direction.WEST);
    Wall w1 = new Wall(ny, 1, 1, Direction.WEST);
    Wall w2 = new Wall(ny, 2, 1, Direction.WEST);
    Wall w3 = new Wall(ny, 2, 1, Direction.SOUTH);
    Wall w4 = new Wall(ny, 2, 2, Direction.SOUTH);
    Wall w5 = new Wall(ny, 2, 2, Direction.EAST);
    Wall w6 = new Wall(ny, 1, 2, Direction.EAST);
    Wall w7 = new Wall(ny, 1, 2, Direction.NORTH);
    Wall w8 = new Wall(ny, 1, 1, Direction.NORTH);
    // Direct the robot to the final situation
    karel.move();
    karel.move();
    karel.turnLeft();
    karel.move();
    karel.move();
    karel.move();
    }
    }"

    that's the exact code im using there and the problem is on line 1 with that error message

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default Re: Beginner and not understanding whats wrong

    What are you trying to import with your import statement?

    Notice that it contains a wildcard (the * character), but the wildcard is in an invalid location. Perhaps you meant this:

    import becker.robots.*;

    However, it's generally considered a bad practice to use a wildcard import like that, so you should consider importing the classes you're using directly.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    jackbrr is offline Member
    Join Date
    Oct 2014
    Posts
    5
    Rep Power
    0

    Default Re: Beginner and not understanding whats wrong

    does it matter what the jar file is called and what you put in the import? like if the jar file is called "becker.robots"

  7. #7
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default Re: Beginner and not understanding whats wrong

    If the jar file is on your classpath, then the only thing that matters is the package and class names.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  8. #8
    jackbrr is offline Member
    Join Date
    Oct 2014
    Posts
    5
    Rep Power
    0

    Default Re: Beginner and not understanding whats wrong

    its only that error causing the problem when I select build file

  9. #9
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default Re: Beginner and not understanding whats wrong

    Did you fix the problem I pointed out? What's on your classpath?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Whats wrong here?
    By kameni123 in forum Android
    Replies: 7
    Last Post: 03-12-2014, 11:30 PM
  2. Help! I don't know whats wrong.
    By xxgetownedxx in forum New To Java
    Replies: 3
    Last Post: 08-16-2013, 10:32 AM
  3. Whats wrong??
    By javaa in forum New To Java
    Replies: 3
    Last Post: 08-29-2012, 02:47 PM
  4. whats wrong with my GUI?
    By EscSequenceAlpha in forum New To Java
    Replies: 12
    Last Post: 05-31-2012, 09:20 PM
  5. whats is wrong with this app??
    By mrajan in forum New To Java
    Replies: 4
    Last Post: 06-09-2010, 11:56 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •