Working at Home

(last updated Sun Mar 30, 2014)

You will need to install, at most, three pieces of software: The Java Development Kit (JDK), the Eclipse editor and the jGRASP editor. The directions differ based on your operating system.


Windows users:

1) Install Java Development Kit (JDK)

Java 8 was recently released and includes many interesting new features. Because we will not be using these new features and have not verified that the new version is compatible with all of our materials, we recommend using Java 7.

Go to the following Oracle Java download page. Scroll past the Java 8 downloads to "Java SE 7u51".

  • download JDK

You will be taken to a new page with the heading, "Java SE Development Kit 7 Downloads." Scroll down to the section labeled "Java SE Development Kit 7." You will see a list of files to download for various operating systems. Click Accept License Agreement, and then click the appropriate link for your operating system to download the file. For Windows users, you should choose jdk-7u51-windows-i586.exe. (Unless you use 64-bit Windows, in which case you want jdk-7u51-windows-x64.exe. If you aren't sure, click here for more info.)

  • download JDK
  • download JDK

Once you have finished downloading this file to your Desktop, you must install JDK on your system. Do this by double-clicking the JDK installer file you saved on the Desktop.

  • download JDK
  • download JDK

You can just repeatedly click Next to choose all the default options during installation.

2) Download Eclipse editor

Eclipse is our suggested primary editing software for this course.

  • Go to eclipse.org/downloads.
  • Click the second link titled "Eclipse IDE for Java Developers". (This is usually the second link in the list; you do NOT want the "IDE for Java EE developers".)
  • Download the ZIP file, extract its contents, and then run eclipse.exe to start the program.

TA Daniel Otero has written a comprehensive tutorial for installing and using Eclipse at the following address:

3) Download jGRASP editor

Go to the following web page to download the jGRASP editor software to work on Java programs for this course:

From the jGRASP web site link above, click the button at top-right labeled Download jGRASP. You will be taken to a download page with some survey information. You can just scroll down and skip the survey. Underneath the survey is a set of buttons. We recommend that you choose the latest stable release (2.0.0_08) rather than the beta. Click the jGRASP exe button to download an EXE file. Save the file to your Desktop or another convenient location.

Once you have finished downloading this file to your Desktop, you must install jGRASP on your system. Do this by double-clicking the jGRASP installer file you saved on the Desktop. Once you are done installing jGRASP, you should now have icons on your Desktop and in your Start Menu for running jGRASP.

  • download jGRASP
  • (Our screenshots show an older version number, but the overall process is the same.)
  • download jGRASP
  • download jGRASP

Extra information for 64-bit Windows:

We have had particular problems come up for students using the 64-bit edition of Windows. This section discusses those issues and how to work around them.

How do I know if I have 64-bit Windows? If you have Windows 7 or Vista but aren't sure whether it's the 64-bit edition, follow these instructions to find out:

  • Click the Start button, then choose Control Panel.
  • Click System and Maintenance, then System.
  • Now you should be seeing "Basic information about your system", including whether it is 64-bit.

For a system that is 64-bit, you will see something like the following (the note about 64-bit appears about three-quarters of the way down):

  • 64-bit instructions

If you have a Windows-64 machine, then when downloading the JDK, you should list your platform as "Windows x64." There seems to be a problem with jGRASP that it doesn't install properly on 64-bit machines. People are finding that when they try to compile a program, they get an error message like this:

   jGRASP wedge2 error: command "javac" not found.
      This command must be in the current working directory
      or on the current PATH to use this function.
      PATH is
      "c:\videos;C:\Windows\system32;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\hp\bin\Python;C:\Program
      Files (x86)\UWICK\SSH Tectia\SSH Tectia AUX;C:\Program Files
      (x86)\UWICK\SSH Tectia\SSH Tectia AUX/Support binaries;C:\Program Files
      (x86)\UWICK\SSH Tectia\SSH Tectia Broker;C:\Program Files
      (x86)\UWICK\SSH Tectia\SSH Tectia Client".
   
      Make sure you have the full JDK (J2SE SDK or other), not just the JRE,
      installed.
      The J2SE SDK is available from java.sun.com.
   jGRASP: operation complete.
		

One student fixed this problem by following these steps:

"I was able to get jGRASP to be used. At first I was expecting the program not to work correctly and I tried different things first. I installed the JDK 64 bit version first which caused the error wedge2 error. I then decided to use compatibility mode to XP SP 2, which that cause a whole entire new error. Then I installed the traditional 32 bit JDK and turned off compatibility and it somehow worked."

So, in other words, installing/using the standard 32-bit JDK rather than the 64-bit one may be the best choice at this time.


Mac OS X:

1) Install Java Development Kit (JDK)

Macs with the OS X operating system will have the Java compiler available automatically or will download and install it automatically, so you should be able to skip this step. But many Macs have an out-of-date version of JDK, so you may need to install the latest Mac version of JDK. Some newer Macs (purchased within the last 4 years or so) may already have this software, but older ones do not. If you have a fairly new Mac, try to skip to Step 2 and 3 and see if Eclipse and jGRASP work, and if not, come back to this step. You might also want to run your Mac's built-in Software Update feature to see if it updates your Java for you.

You can test whether your Mac has Java installed (and if so, what version) using the Terminal application. To run the terminal, use your Spotlight icon at the upper-right of your screen to search for Terminal. It will find and suggest the Terminal application. Click it to run the terminal. A white window will appear with black text and a blinking cursor for you to type commands. Type the following command and press Enter, to see your version of Java:

java -version

If your Mac doesn't have Java installed already (or has an obsolete version installed), you can go to the web page below to download it. Once you've downloaded the file, double-click it on your desktop to install it.

  • Find jdk-7u51-macosx-x64.dmg on this page. Be sure to "Accept License Agreement."

2) Download Eclipse editor

Eclipse is our suggested primary editing software for this course. TA Daniel Otero has written a tutorial for installing and using Eclipse at the following address:

3) Download jGRASP editor

http://jgrasp.org/

There is a Mac version of jGRASP, available from the same jGRASP web site by clicking the button labeled jGRASP pkg.

  • screenshot

Once you have downloaded the jGRASP application PKG file, double-click it to install jGRASP. At each screen, you can choose the default options and click "Continue" or "Install" to move forward. If you've done it correctly, you will see an "Install Succeeded" message and a green checkbox.

  • screenshot
  • screenshot

Once jGRASP is installed, you can run it from your Applications folder, Dock, or by typing "jgrasp" into your Spotlight search at the top-right of your screen.

Common Mac jGRASP issues:

  • Some students are reporting issues with jGRASP on the Mac. Some report seeing the following strange message:

    share cache file is corrupt: /var/b/yl/yl_share_cache_ppc
    

    If you see this message, you should update your Mac to Java v1.6 by running the Mac's built-in Software Update tool. Then re-run jGRASP and click Settings, jGRASP Startup Settings, and set your Java version to 1.6.0.

  • If you see an error message on startup of jGRASP that has a "jGRASP Startup Settings" button, click it. Then where it says "Java executable (for running jGRASP):" it will probably say [Default]. Clear that out and instead, type in:
    /usr/bin/java
    

    Click "Ok" and close the error message window. Then re-open jGRASP and the problem may go away.

  • Some students are reporting that characters are missing from their println messages on the console. We don't know what is causing this. If you have this bug, let us know what kind of Mac you have (Intel or PPC? What OS X version? etc.) and we'll try to figure it out.
  • If you continue having problems with jGRASP, you may want to try another Java editor named DrJava.

Linux:

(These directions are a few months out of date, but the general idea can still be followed.)

It's tougher to give an installation guide for Linux because of the large variety of different distributions and architectures. Here is a rough guide that will work for many distributions such as Ubuntu.

1) Install Java Development Kit (JDK)

If you use Ubuntu Linux (or a derivative thereof), you can install Java through their apt-get package manager system. Type the following three commands:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

Otherwise, get Java from Sun/Oracle's web site:

http://java.sun.com/javase/downloads/index.jsp

Follow the above link and click the "Download" button next to the "JDK 6.0 Update 21". (NOT the "with NetBeans 5.0" link or the "with Java EE" link or others). Accept the License Agreement and choose the "Linux self-extracting file" file:

jdk-7u51-linux-i586.bin

(If you use a Linux distribution that supports RPM packages such as Fedora Core, you may wish to use the "Linux RPM in self-extracting file" package.)

Once you have finished downloading the JDK .bin file, open a terminal window and execute the file. You may have to give execution permissions to the file:

chmod +x jdk-7u51-linux-i586.bin
./jdk-7u51-linux-i586.bin

Running the .bin file extracts the JDK contents. Move these to a directory of your choice. (The rest of this tutorial assumes you have moved the JDK to /usr/lib/jdk/ .)

After installing Java, you will probably wish to add Java's directory to your PATH setting, so that you can run Java commands from your terminal. To do so, edit the file .bashrc in your home directory and add the following lines to the end of it:

export PATH=/usr/lib/jdk/bin:$PATH
export CLASSPATH=.

You should close your terminal and open a new one for the PATH changes to take effect.

2) Download jGRASP editor

http://jgrasp.org/

There is a Linux version of jGRASP, available from the same jGRASP web site by clicking the button labeled jGRASP zip. Download this file and extract its contents. Then open a terminal and cd to the directory of those contents and type:

java -jar jgrasp.jar

3) Set Up BASH Script File (optional)

If you are unable to get the jGRASP debugger working in Linux, try downloading the following jgrasp BASH script file and putting it in the jgrasp/bin folder. Give it execute permissions (chmod +x) and then use it to run jGRASP.

icon jgrasp bash script


Useful Options for Your Operating System

Enable File Extensions in Windows:

By default, Windows does not show extensions of certain types of files. This can lead to confusion because you may not know which file is your .java program and which is your .class compiled file.

If you'd like to change this value, open My Computer. From the window's main menu, click the following:

Tools, Folder Options...

A Folder Options window will appear. Click the tab labeled View, then find the checkbox labeled Hide extensions for known file types. Uncheck it. Press OK.

Now all files should show their extensions in Windows.


Common JDK/jGRASP Problems and Errors:

International Error Messages:

Some users who have international (Chinese, Korean, etc.) versions of Windows cannot properly see the compiler errors in jGRASP. To fix this problem, follow these steps in jGRASP.

Click "Settings" -> "Compiler Settings" -> "Workspace".

screenshot

In the settings box that pops up, click the "Flags / Args" tab (in the lower row of tabs). Then, click the black "button" under "FLAGS or ARGS" and next to "Compile". In the text box that becomes available type in "-J-Duser.language=en" (without the quotes) and click "OK".

screenshot

(Thanks to TA Eric Spishak for writing this tip!)

Unable to install 64-bit jGRASP on Windows 7 / Vista:

Some Windows 7 / Vista users report that their system just sits idle when they double-click the Java JDK installer icon. They are unable to install JDK. Usually this problem can be solved in one of two ways:

  1. Try installing the 32-bit version of JDK (sometimes labeled the "x86" version on the Sun/Oracle download page), or
  2. Try installing JDK v1.6 instead of 1.7.