06-karel-in-eclipse

06-karel-in-eclipse - CS106A Handout #6 June 23, 2009 Using...

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

View Full Document Right Arrow Icon
Handout #6 CS106A June 23, 2009 Using Karel with Eclipse Based on Handout by Eric Roberts Once you have downloaded a copy of Eclipse as described in Handout #5, 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 CS 106A assignment page, you’ll see a display that looks something like this: If you click on the link for Assignment1.zip , 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 notes on the assignment page above tell you what software you need. The unzipped contents 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. 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 #5. Find the small icon in the toolbar that looks like this:
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 – 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 Assignment-1 or 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.

Page1 / 8

06-karel-in-eclipse - CS106A Handout #6 June 23, 2009 Using...

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