06-karel-in-eclipse

06-karel-in-eclipse - Mehran Sahami CS 106A Handout #6...

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

View Full Document Right Arrow Icon
Mehran Sahami Handout #6 CS 106A September 23, 2009 Using Karel with Eclipse Based on a 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 CS106A assignment page (go to the CS106A web site and click the Assignments link) , you’ll see a display that looks like something this: If you click on the link for Assignment1.zip , your web browser will download the starter folder. In some cases, the browser will also unzip/extract the folder automatically, assuming that you have the appropriate software for expanding files from a ZIP archive. If you don't have software to unzip/extract the archive, see the text on the assignment page to see what software you may need (for example, extraction software is usually built-in to Windows Vista or Mac OS X). 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:
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 load a project folder into Eclipse so that you can work with it. Click on this button and then click the Browse button to find and highlight (click on) the Assignment1 folder, then click OK . (Note that if you see an Assignment1 folder inside another folder named Assignment1 , you want to select the innermost Assignment1 folder.) Now, make sure that the check box labeled Copy projects into work space is not checked (if the box is checked, just click on it to uncheck it). Then click the Finish button. When you do so, Eclipse will load the starter project and display its name in the Package Explorer window like this: The small plus-sign (triangle on the Mac) to the left of the folder name indicates that you can open it to reveal its contents. Clicking on the plus-sign/triangle exposes the first level of the package: At this point things look a more promising there is something about "worlds" there on the last line (or you might see a reference to "karel.jar" on the Mac). Things get more interesting when you open the
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

06-karel-in-eclipse - Mehran Sahami CS 106A Handout #6...

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

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