04-Using-Karel-In-Eclipse

04-Using-Karel-In-Eclipse - CS106A Handout 04 March 30th,...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CS106A Handout 04 Spring 2011 March 30 th , 2011 Using Karel In Eclipse This handout was written by Eric Roberts. Once you have downloaded a copy of Eclipse as described in Handout 03, your next task is to understand how to write Karel programs using the Eclipse framework. Although it is not all that hard to create new Eclipse projects from scratch, it certainly reduces the complexity of assignments if we provide starter projects to get you going. That way, you can ignore all the mechanical details of making new projects and focus instead on the problem-solving aspects of the assignments. Downloading starter projects The first step in working with any Karel assignment is to download the starter project for that assignment. If you go to the CS106A website, you’ll see a display that looks like this: If you click on the link Assignment 1: Karel under the Assignments section, your web browser will download the starter folder. In most cases, the browser will also unzip the folder automatically, assuming that you have the appropriate software for expanding files from a ZIP archive. The unzipped content of the zip file is a directory named Assignment1 that contains the project. Move that folder to someplace on your file system where you can keep track of it when you want to load the project.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Importing projects into the workspace From here, your next step is to start up Eclipse, which will bring up the Eclipse window shown on the last page of Handout 03. Find the small icon in the toolbar that looks like this: This button is the Import Project button and is used to copy a project folder into the Eclipse workspace so that you can work with it. Click on this button and then use the Browse option to find the Assignment1 folder. When you do so, Eclipse will load the starter project and display its name in the Package Explorer window like this: The small triangle to the left of the folder name indicates that you can open it to reveal its contents. When you click on the triangle, it exposes the first level of the package: Things look a little more promising. At least there is something about Karel there on the last line. But things get still more interesting when you open the default package, which is where all of the code you will write this quarter will end up. Opening this package reveals
Background image of page 2
3 Now things have gotten much more exciting. There—right on the screen—are the Java files for each of the assignments. You can open any of these files by double-clicking on its name. If you double-click on CollectNewspaperKarel , for example, you will see the following file appear in the editing area in the upper right section of the Eclipse screen:
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/28/2011 for the course CS 106A taught by Professor Sahami,m during the Spring '08 term at Stanford.

Page1 / 9

04-Using-Karel-In-Eclipse - CS106A Handout 04 March 30th,...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online