|
|
|
|
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:
- The Java SDK from Sun or Apple
- One or more of
(ask your instructor which)
- DrJava: a Java
interpreter and development environment
- Eclipse:
an industrial-strength Java development environment that has become
very popular in the open-source community. (not required for 142)
- 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.1.
Go visit the
J2SE
download page. The distribution is big, roughly 36MB, so
if you're connecting by slow modem, be sure to allow plenty
of 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:
-
Be sure you install the Java Standard Edition Software Development
Kit (J2SE SDK). 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.
-
If you have earlier versions of Java on your machine remove the
old versions before you install the new one. 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_03 for version 1.4.1_03, with similar names
for other versions. 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 remove 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 do use
other directory names, you may have to make changes in
other parts of the installation to match. No matter what
directory name you use, be sure that there are no spaces
in it. For example, do not use "Program Files". Spaces
in the directory names cause all kinds of strange
problems.
-
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
-
Be sure you have already installed the Sun Java 2 SDK first (see
above).
-
Create a folder for the CSE142/3 files. We strongly recommend
you use the name C:\CSE. It will make set-up much easier.
- Download the following file and place it in C:\CSE: uwcse.jar
- Instructions for configuring the development environments
(DrJava and BlueJ) to use the UW CSE library files are given below.
DrJava
- 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.
- 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.
- Start DrJava.
- From the Windows command line, you can change to the directory where you put
DrJava, then run it from there. For example,
- Start -> Programs -> Accessories -> Command Prompt
cd \cse
javaw -jar drjava-stable-20030313.jar
- (Windows, Unix, Linux) You should be able to run DrJava
by double-clicking on the drjava jar file. This
assumes that the file associations are correct for jar files,
which should have been set when you installed the Java SDK.
On Windows, the correct association is for jar files to open
with the command shown above, including the -jar switch.
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_xx\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.
- 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_03\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.
- 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.
- 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.
- Start DrJava if it is not already running.
- Select Preferences from the Edit menu.
- Select the Resource Locations tab if it is not already
selected and click Add.
- In the file dialog that appears, locate the file C:\CSE\uwcse.jar,
click select, then click ok.
- 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.
- 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.
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 Summer 2003, and
we have less experience supporting it, so watch and contribute to the
discussion board as issues come up.
- 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.
- 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.
- 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).
- Start Eclipse by double clicking the Eclipse application.
- Tell Eclipse where to find the CSE142/143 library files if you need
them.
<to be supplied>
- 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.
|
 |
Department of Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA 98195-2350
[comments to cse142-webmaster]
|
|