Search code examples
javakarel

Karel Robot: Could not find or load main class


I run this command to compile, it runs successfully:

javac -d . -cp .;KarelJRobot.jar StairClimber.java

Then I use this to try and run my class:

java -d –cp .;KarelJRobot.jar StairClimber

and I get this:

Error: Could not find or load main class ûcp

This is the entire class file:

import kareltherobot.*;

public class StairClimber {
    public static void main(String[ ] args)
    {   
        /* You fill this in */
        World.setVisible(true);
    }
}

I got the Karel Simulator from here:

http://csis.pace.edu/~bergin/KarelJava2ed/KJRDistribution060110.zip

Solution

  • java -d –cp .;KarelJRobot.jar StairClimber
    --------^
    

    Your cp argument hyphen is wrong. You need the - one next to 0 on your (US) keyboard. Do not copypaste the command from some PDF file or website. Enter the command all yourself.

    java -d -cp .;KarelJRobot.jar StairClimber