I have started taking the course Programming methodology(CS106A) available at stanford website. But I am not able to start the Stanford Karel in it.
I am using eclipse indigo classic 3.7.1 and Windows 7 64 bit OS..
I wrote the following code:
import stanford.karel.*;
public class CollectNewspaperKarel extends SuperKarel {
// You fill in this part
public void run(){
move();
move();
}
}
It gives the error
Exception in thread "main" java.lang.NullPointerException
at acm.program.Program.main(Program.java:917)
at stanford.karel.Karel.main(Karel.java:202)
I followed some instructions given here but then got a blank screen as the output.
The assignment1 of stanford can be found here, and karel the robot of stanford is available here
hello bhuwansahni though I have written an answer before, but now I am writing the entire process to run Karel in any eclipse version.
Create a new project in your Eclipse (File-----> New-----> Java Project)
Load your assignment in the Created Project.
step a:- Extract Assignment 1 in your desired folder.
step b:- import the assignment (File-----> Import----->General-----> Files system-----> browse your folder and complete the importing.)
Now run it in a different way (Run-----> Run Configurations-----> )
Step a:- Under Java Applet Create New Configuration.
Step b:- Under Main write the Main Class stanford.karel.Karel
Picture for **Step b of Step 3] http://i.stack.imgur.com/0LpI3.jpg
Step c:- Under (x)= Arguments in Program Arguments write code=CollectNewspaperKarel
Picture for **Step b of Step 3] http://i.stack.imgur.com/alIss.jpg
Step d:- Apply and Run
Now Here comes the Karel the most Lovable Robot.
Picture for **Step 3] URL:- (i.stack.imgur.com/d8SAa.jpg) put http:// in front to see it... as here I can't post more than two hyperlinks.
public class StoneMasonKarel extends SuperKarel {
public static void main(String[] args) {
stanford.karel.Karel.main(new String[] { "code="
+ StoneMasonKarel.class.getCanonicalName() });
}
public void run() {
}
}
You need Java6.
In Eclipse:
Then I implement a main method for each project like the one above. For each rename StoneMasonKarel.class
to whatever your class name is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With