Wednesday, December 30, 2009

AP Comp Sci: Installing and using the Gridworld .JAR file

AP Comp Sci students,

This term we'll be working the Gridworld Case Study. This post is to help you get through installing and using it with Eclipse.

1. Visit the AP Computer Science Gridworld Case Study website, and download the .zip file called 'Code' at that site. A direct link is here, but it is worth visiting the website above at least once. Here's the formal installation guide -- basically the same information as below.

2. Unzip and set aside the .zip file. Do not alter the file structure within the GridWorldCode folder. It should look something like the following (taken on a PC):


3. Open Eclipse. You will now want to make a new Java project. Call this project 'GridWorld Project 1 - Your Name' (in my case, it would be 'GridWorld Project 1 - Byron Philhour'). Before clicking forward, under 'Contents' click on 'Create Project from Existing Source' and navigate within the GridWorldCode folder to the /projects/firstProject folder.


Click next -- do not click 'Finish' yet.

4. You should be in Java Settings now. Click on the 'Libraries' tab and then on the 'Add External JARs' button. Browse into GridWorldCode and select 'gridworld' (this should be a jar file).



Click 'Open' and 'Finish.'

5. Within the Eclipse workbench, navigate to the new project (you are likely already in it). In the /src folder you will find BugRunner.java. Double-click on it to open it. It should look something like this:


6. Compile and run this program. The 'GridWorld' with a single red bug and a single black rock should appear. You have now successfully begun programming with the GridWorld case study. Here's what it should look like now:


Play around.

Cheers,

BJP

3 comments:

  1. I am trying to load GridWorld into Eclipse Juno and it does not have the same Create Project page where yu create a project from an existing Source. After trying several things I still can not seem to get the GridWorld code in and working.

    ReplyDelete
    Replies
    1. it's not likely this , i can't found something called "Create Project from Existing Source"

      Delete
    2. it's not likely this , i can't found something called "Create Project from Existing Source"

      Delete