CSE logo University of Washington Computer Science & Engineering
 CSE 142 Spring 2003-- Computing at Home
  UW Home     CSE Home   Announcements    Message Board    Contact Info 

CSE 142
 Home page
 Syllabus
Classwork
 Calendar
 Homework/Projects
 Exams and Quizzes
Staying in Touch
 Mailing Lists
 Discussion Board
 Announcement Archive
People
 Instructors
 TAs
 Consultants
 Consultant Schedule
 Pictures
Software & Computing
 Programming Lab Info
 Computing at Home
 Java Libraries
 Troubleshooting
Check Your Scores
 MyUW
   

Introduction

This document should help you get set up for working on a home computer. The software setup is the same for both CSE142 and CSE143 this quarter - these instructions apply to both courses. You'll need to install the following software:

  1. The Java SDK from Sun or Apple (new versions this quarter)
  2. One or more of (ask your instructor which)
    • DrJava: a Java interpreter and development environment (new this quarter)
    • BlueJ: another simple Java development environment
    • Eclipse: an industrial-strength Java development environment that has become very popular in the open-source community.
  3. Local CSE142/143 libraries

We're not particularly religious about which development environment you use.  You can do most of the assignments in this class with very simple tools -- see the end of the document for a low-tech (yet surprisingly powerful and useful) approach -- or with other recent Java 2 programming environments like JBuilder, Forte (now known as SunOne), CodeWarrior (commercial only), and so forth.  You can't use Microsoft Visual J++, however; although it is a well-designed Java environment, it has not been updated in several years and does not support the current version of the the Java language and libraries.

If you want to work at home, you are on your own to some extent in terms of getting stuff set up. Ask friends, read documentation, post a question on the bulletin board, ask us -- but we can't be guaranteed to have an answer. Ultimately you're on your own with your home computer. The lab is always available as a fallback.

Regardless of the development environment that you use, the code you turn in should only rely on the standard Sun Java libraries, and libraries that are distributed by us. Your code should not rely on "wizards", special libraries that might be provided with your environment, or code that comes from the Internet or friends.  The programs you give us will be compiled and run using our set-up.

Java SDK

Java 1.4.1 for Windows, Linux, and Unix

You must first install the Java 2 Platform from Sun Microsystems.  We will be using the Standard Edition, version 1.4 or to be precise, v 1.4.1_02.

Go visit the Java2 home page (really, the page where  you can download the Software Development Kit (SDK) 1.4). The distribution is big, roughly 36MB, so if you're connecting by slow modem, it's going to be a pain. DSL or CableModem users should have an easier time. You can always download it onto a UW lab machine with a CD burner and make a copy that you can carry home to install.

To install, double-click on the j2sdk-XXX.exe installer program that you downloaded from Sun, and then follow the instructions. A couple of notes:

  • If you have earlier versions of Java on your machine and plan to remove them once the current version is installed, remove the old versions first. Use the add/remove programs control panel, and be sure to remove all Java components, including the Java SDK, the Java Runtime Environment (JRE), and Java Web Start. (There is a bug in the Sun installer that can prevent DrJava and other "executable .jar file" programs from launching if older parts of Java are removed after the new version is installed.)

  • We strongly recommend you install the Java SDK in the the default directory suggested by the installer, which is C:\j2sdk1.4.1_02 for version 1.4.1_02. By doing that, you can keep your environment consistent with IPL machines and most students and TAs' environment. And you should be able to download the tools from us and run them directly without the need of modification. If you already installed Java SDK in another directory, we recommend you delete it - including the SDK, JRE, and Java Web Start - using the add/remove programs control panel, then run the installer and let it put the SDK in the default directory. (Do NOT just rename the original directory. It will NOT work). If you really want to use other directory names, you may have to make changes in other parts of the installation to match.

  • Be sure you install the Java Standard Edition Software Development Kit (J2SE™ SDK), formerly known as the Java Development Kit (JDK).  There is a smaller package called the Java Runtime Environment (JRE), which is a subset of the SDK that includes files needed to run, but not create, Java programs.  The JRE is not adequate for our purposes -- be sure to get the SDK.

  • A sizeable part of the SDK distribution is source code.  If disk space is limited on your machine, you don't need to install the source code, or the demos, but install everything else.  (You'll eventually get the option of what you want to install when you run the j2sdk-XXX.exe installer program that you downloaded from Sun.) However, in past quarters, some students have had trouble getting Java to work if only part of it is installed, so it is best to install the entire package if you can.

Java 1.4.1 for Macintosh OS X

An earlier version of Java, 1.3.1, comes pre-installed on OS X. Java 1.4.1 was released in March 2003 for OS X 10.2.3 (Jaguar) and later versions. It is not available for OS X 10.1 and Mac OS 9 and earlier. To install Java 1.4.1, open the software update control panel, select check for updates, select Java 1.4.1 from the list of available updates, and click update. This is a large download, about 30MB, which is reasonable on a DSL or Cable modem line, but can be a pain if you have a slow dialup line. You can download the update from Apple on a campus machine with a CD burner and make a copy on CD to carry home.

If you have installed the Developer Tools software that comes with OS X, you should get the Java 1.4.1 OS tools update and install it (available at http://developer.apple.com/). If you did not install or don't plan to use the Developer Tools, this is not necessary.

If you have an earlier version of OS X and want to buy the newer version, be sure to take advantage of the educational discount available through Apple's web site (click store at the top of Apple's main page, then click education on the horizantal banner).

Folders and UW CSE Software LIbrary

  1. Be sure you have already installed the Sun Java 2 SDK first (see above).
  2. Create a folder for the CSE142/3 files.  We strongly recommend you use the name C:\CSE. It will make set-up much easier.
  3. Download the following file and place it in C:\CSEuwcse.jar
  4. Instructions for configuring the development environments (DrJava and BlueJ) to use the UW CSE library files are given below.

DrJava

  1. Be sure you have installed the Sun Java SDK or Apple Java update first. You don't need to install BlueJ or other additional tools to use DrJava.
  2. DrJava's web site is http://drjava.sourceforge.net/. You want to install the latest stable release. DrJava is about 1.5MB in size, so it is a reasonable download even over a slow dialup connection.
    • (Windows, Unix, and Linux) Click on the download button to get the .jar file containing DrJava. This file can be placed anywhere, but we strongly suggest putting it in the C:\CSE\ directory.
    • (Mac OS X) Click on the download Mac OS X app button to get the OS X version of DrJava. This should usually be put in your Applications folder.
  3. Start DrJava.
    • (Windows, Unix, Linux) On most of these systems, you should be able to run DrJava by double-clicking on the drjava-xxx.jar file. On windows, if you are asked to pick the program to run DrJava, pick javaw.exe, which is found in the C:\j2sdk1.4.1_02\bin folder.
      For future convenience, if you're using Windows, you might want to create a shortcut to the DrJava file and place it on the desktop or in some other convenient location. Right-click on the DrJava file and select create shortcut from the popup menu.
    • (Mac OS X) DrJava runs as a normal application. Double click to start it.
  4. The first time you start DrJava on Windows and some other systems, you may get a message saying "DrJava cannot find any Java compiler. Would you like to configure [it]..." Click on yes. Assuming you've used the default Java SDK installation, use the file dialog to select C:\j2sdk1.4.1_02\lib\tools.jar. DrJava should then open its main window. This extra step should not be necessary with recent versions of DrJava, and is not necessary on Mac OS X.
  5. To verify that DrJava is working, enter the following line, including the semicolon, in the bottom window pane to the right of the ">" prompt.
    System.out.println("Hello");
    Hit return (enter) and DrJava should display the word hello below the line that you typed.
  6. Tell DrJava where it can find the CSE142/143 library files. This only needs to be done once. You must first have installed the libraries on your system.
    1. Start DrJava if it is not already running.
    2. Select Preferences from the Edit menu.
    3. Select the Resource Locations tab if it is not already selected and click Add.
    4. In the file dialog that appears, locate the file C:\CSE\uwcse.jar, click select, then click ok.
    5. To test that the new libraries are installed correctly, enter the following two lines of code at the bottom of the screen.
      import uwcse.graphics.*;
      GWindow w = new GWindow();
      If everything is installed properly, an empty window named DemoWindow should appear on the screen.
  7. If you want to use the new assert statement that was added to Java in version 1.4 (optional for CSE142, needed for CSE143), start DrJava if it is not already running, select Preferences... from the Edit menu, select the Miscellaneous category, then click the Allow assert keyword in Java 1.4 check box in the middle of the panel, and click ok. This only needs to be done once. DrJava currently does not support the use of assert in the interactions window at the bottom of the screen, but you can use it in any new classes that you create.

BlueJ

  1. Be sure you have installed the Sun SDK or Apple Java update first. You don't need to install DrJava or other additional tools to use BlueJ.
  2. BlueJ is available from www.bluej.org.  Download the latest BlueJ version (currently 1.2.2) from their distribution page. The download is around 1MB, so it's reasonable to download even over a modem. The bluej.jar file can be placed anywhere.
  3. Install BlueJ
    • (Windows) Double-click on the bluejsetup-122.exe file that you downloaded above. You can install BlueJ anywhere, but we suggest you put it in the C:\CSE folder. When the installer asks you where to install BlueJ, open the c:\cse\ folder, then select next.
    • (Other systems) Follow the installation instructions on the BlueJ web site.
  4. Start BlueJ
    • (Windows) Run BlueJ from the Start>All Programs menu, or double click the BlueJ icon that the installer placed on the desktop.
    • (Other systems) Double-click the bluej file created during installation.
  5. Tell BlueJ where it can find the CSE142/143 library files. This only needs to be done once. You must first have installed the libraries on your system.
    1. Start BlueJ if it is not already running.
    2. Select Preferences... from the Tools menu then click on the Libraries tab.
    3. Click the Add button and select the file C:\CSE\uwcse.jar. Click open, then click ok.
    4. Click ok once more and then quit BlueJ. Restart to use the new libraries.
    5. To test that the new libraries are installed correctly, you can download the file UWCSETest.java and save it in a folder (you may need to right-click on the link and select "Save Target as...", then save the file as UWCSETest.java). Run BlueJ and select Open non-BlueJ from the File menu. Select the folder containing the UWCSETest.java file (not the file itself) and click ok. Click the compile button. If that works, the libraries are successfully installed.
  6. If you want to use the new assert statement that was added to Java in version 1.4, start BlueJ if it is not already running, select Preferences... from the Tools menu, select the Miscellaneous tab if necessary, then click the Enable JDK 1.4 features (assertions) check box in the middle of the panel, and click ok. This only needs to be done once

    [Mac OS X note: BlueJ currently does not automatically configure itself to use Java 1.4.1 on OS X; instead it uses the Apple default of 1.3.1, and the "Enable assertions" check box will be dimmed out. The next release of BlueJ will fix this, but for now, you can fix it as follows if 1.4.1 is not automatically recognized.
    1. Find the BlueJ application
    2. Right-click (control-click) the BlueJ application and select show package contents
    3. Open Contents/Resources/MRJApp.properties using a regular text editor
    4. Add the following line at the end of the file:
      com.apple.mrj.application.JVMVersion=1.4+
    5. Save the file and close the text editor. BlueJ should use Java 1.4.1 the next time it is restarted. You can check by going to the preferences panel - the "Enable assertions" check box should be available.]

Eclipse

This is a full-featured development environment that has an enthusiastic following in the open-source community. It is probably overkill for the projects encountered in introductory courses like CSE142 and CSE143, but more advanced students may find it useful for larger projects. Eclipse is a new addition to these instructions for Spring 2003, and we have less experience supporting it, so watch and contribute to the discussion board as issues come up.

  1. Be sure you have installed the Sun SDK or Apple Java update first. You don't need to install DrJava, BlueJ, or other tools to use Eclipse.
  2. Eclipse is available from www.eclipse.org. The latest version, 2.1, was released on Friday, March 28. This is a big download (~60MB), so if you have a dialup line, you may want to download the file in a campus lab and burn it onto a CD to carry home.
  3. Install Eclipse by double-clicking the installer (windows), moving the application to the Applications folder (Mac OS X), or unpacking the zip file and installing using the usual conventions for your system (others).
  4. Start Eclipse by double clicking the Eclipse application.
  5. Tell Eclipse where to find the CSE142/143 library files if you need them.
    <to be supplied>
  6. To use the assert statement with Eclipse, do the following.
    <to be supplied>

Textbook Libraries

As you read the textbook, you may come across references to special Java libraries and sample code that the textbook authors have created.  If these are needed for your course, you will receive specific instructions for how to use them with your assignments.  Of course, you are welcome to study the code samples in the textbook.  As you do, please keep in mind that they may use features or libraries which will not be discussed in our course.

Old School

Once you have installed the Java SDK on your home machine, you can actually build Java programs without DrJava, BlueJ, or Eclipse. The SDK comes with command-line tools that you can use to compile programs, and a functional debugger, called jdb. You'll want to use a good editor to write your programs, the best of which is emacs (read more about emacs). There is a faster compiler available called jikes, from IBM. The advantage of using this approach is while it may not be quite as easy as an integrated environment, you'll learn to use some tools that you can use in many other contexts as well.

 


CSE logo Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
[comments to cse142-webmaster]