I've started to try and learn basic programming and some java by going through stanfords programming methodologies lectures on youtube http://www.youtube.com/playlist?list=PL84A56BC7F4A1F852 and trying to work through their course materials http://www.stanford.edu/class/cs106a/index.html
Now one of the first things they teach is a little program that allows you to program it to move around, pick up and drop stuff etc..., and they want you to use simple methods that it's already programmed for to create patterns and solve simple problems.
What I've done is downloaded the eclipse from their link, set it up to use Java 6 (as some people say it has issues with the latest version), and then downloaded their assignments and am currently trying to get the program that goes with lecture 2 to work, a basic karel program.
I downloaded the zip, extracted it to a folder and it contains some .java files, some .class files, and a karel.jar. I loaded the .java file into eclipse:
The problem is, every time I try to click run I get an error "workspace does not contain a main type (do you have a public void run() method?)
Obviously there is a public void run() method, and the examples in the lecture just run fine. So I would be grateful if anyone can help solve this problem.
It's a little hard to solve these issues when I'm just watching youtube videos rather than sitting in a classroom, but these youtube videos are far more interesting and getting me more excited about programming than just reading a book or following a guide online. So if I can just get this working I think I will be with a good shot of really getting into this.
Now one of the first things they teach is a little program that allows you to program it to move around, pick up and drop stuff etc..., and they want you to use simple methods that it's already programmed for to create patterns and solve simple problems.
What I've done is downloaded the eclipse from their link, set it up to use Java 6 (as some people say it has issues with the latest version), and then downloaded their assignments and am currently trying to get the program that goes with lecture 2 to work, a basic karel program.
I downloaded the zip, extracted it to a folder and it contains some .java files, some .class files, and a karel.jar. I loaded the .java file into eclipse:
Code:
/*
* File: FirstKarelProgram.java
* ----------------------------
* This program solves the problem of moving a beeper to a ledge.
*/
import stanford.karel.*;
public class FirstKarelProgram extends Karel {
public void run() {
move();
pickBeeper();
move();
turnLeft();
move();
turnRight();
move();
putBeeper();
move();
}
private void turnRight() {
turnLeft();
turnLeft();
turnLeft();
}
}
The problem is, every time I try to click run I get an error "workspace does not contain a main type (do you have a public void run() method?)
Obviously there is a public void run() method, and the examples in the lecture just run fine. So I would be grateful if anyone can help solve this problem.
It's a little hard to solve these issues when I'm just watching youtube videos rather than sitting in a classroom, but these youtube videos are far more interesting and getting me more excited about programming than just reading a book or following a guide online. So if I can just get this working I think I will be with a good shot of really getting into this.
Last edited: