<<

Installing , jGrasp, and JKarel at Home

You need two different programs, Java and jGrasp. You need to download and unzip the student shell code file and then put two little files in the right folder. Finally, you will need to set a Classpath in jGrasp.

1. Java JDK: This is the JDK () that you will need to write programs in Java. Download and install the Java Developer’s Kit (JDK) using the link on my webpage. You will need to look down in the list for the version that works on your operating system. Most of you who use Windows can download the Windows x86 version which should work on any Windows installation.Let it install in the default directory. The JDK includes the Java Runtime Environment (JRE) so you don’t need to install that separately.

2. jGrasp: This is the jGrasp IDE (Integrated Development Environment) that we will use in class to write our Java programs. Download and install it using the link on my webpage. Let it install in the default directory. (You do not need to provide any information on the form, you can just press the download button.)

3. Setup Files: These are the special files that you will need to run some of the labs this year. Download them using the link on my webpage. Create a directory for the code and copy of the contents from the zip file into the new directory using Windows Explorer. After unzipping, you will see a Setup Files folder.

4. Copy 2 jar Files: In the Setup Files folder are two files, karel2_c.jar and xercesImpl.jar. Copy them both into the folder C:\Program Files\Java\jre7\lib\ext

5. Test Installation

a. Test your installation on a standard Java program. Double-click on jGrasp. Then type in, save as HelloWorld,compile,and run:

public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } }

b. Test your installation on a JKarel program. Double-click on jGrasp. Then type in, save as HelloKarel in the Unit1 folder, compile, and run:

import edu.fcps.karel2.Display; import edu.fcps.karel2.Robot; public class HelloKarel { public static void main(String[] args) { Display.setSize(10, 10); Robot karel = new Robot(); karel.move(); karel.turnLeft(); karel.move(); } } You will likely get an error message "cannot find edu\fcps\karel2\Display". The next step is to change the Classpath in jGrasp under the menu Settings|Path- Classpath|Workspace. Click on “new” and browse to wherever you put the karel2.jar. Click on Use, then on OK.

Run the JKarel program. If something doesn’t work, make note of any error messages and bring them to your teacher.

1

4 3

2

5