Setting up Karel the Robot In Eclipse

Exception in thread "main" java.lang.NullPointerException
	at acm.program.Program.main(Program.java:917)
	at stanford.karel.Karel.main(Karel.java:202)

If you are getting this error after you tried to run “Karel the robot” , you are not alone.
Apparently, if you download the version of eclipse that Stanford provides you are unlikely to get the error but if you are like me trying to run your own version of eclipse you will likely get the error.

Here is how to fix it:

First

Manage to get your application into eclipse. Follow the Stanford tutorial

Second

Click on “Run as Configuration”

Third

Change the main class settings to “stanford.karel.Karel”

Fourth

Then probably the most important step: Enter “code=CollectNewspaperKarel” in program arguments under the arguments tab.
Click on Apply and then Run your program.

Final Result (Eclipse Indigo)

That should be it.  This was supposed to be easy apparently.

Interesting links:
http://www.stanford.edu/class/cs106a/cgi-bin/software/
http://www.freesoftwaremagazine.com/columns/getting_stanfords_karel_robot_run_debians_eclipse
http://www.youtube.com/watch?v=jWMW2ZfYPo4

17 comments Write a comment