|
|
|
|
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
- Probably one or more of (ask your instructor which)
- DrJava: a Java
interpreter and development environment designed for learners, but
robust enough for developing substantial projects.
- Eclipse:
an industrial-strength Java development environment that has become
very popular in the open-source community.
- Local CSE142/143 libraries
We're not particularly religious about which development environment
you use. You can do most of the assignments in CSE142/3 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 BlueJ, jGrasp,
JBuilder,
Sun One Studio
(formerly known as Forte), the NetBeans
IDE, CodeWarrior
(commercial only), and so forth. You can't use Microsoft Visual
J++, however; it does not support current versions 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 UW
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 (unless your instructor says that this is
appropriate for a particular assignment). The
programs you give us will be compiled and run using our set-up, which
is the standard Java language and libraries..
Java SDK
Java 1.4.2 for Windows, Linux, and Unix
You must first install the Java
2 Platform from Sun Microsystems. We suggest using the latest
version of the Standard Edition, version 1.4 or to be precise, v
1.4.2_04, however any recent release of version 1.4.1 or 1.4.2 is also
ok if you
have that installed.
Go visit the Java2
download page. If you're downloading the Windows
version,
be sure to get the "windows offline installation", which includes
all files needed and doesn't require an active internet connection to
install. The distribution is big, roughly 36MB, so if you're connecting
by slow modem, it's going to be a pain. DSL or Cable Modem 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
replace them with the current version, 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 some versions
of the Sun installer that can prevent some Java 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.2_04 for
version 1.4.2_04.
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, and you're on
your own.
-
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.
-
We recommend that you install everything. If disk space is really
limited on your machine, you can try omitting the source code and
demos to save space, 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 for Macintosh OS X
Panther: Java 1.4.1 comes installed on OS X 10.3 Panther. Java
1.4.2 is available from the software update control panel and we suggest
you
install it.
Jaguar: Version 10.2 of OS X includes Java 1.3.1. Version
1.4.1 is available from software update and we suggest you install it.
Version 1.4.1 should work fine for CSE142 and CSE143, but if you want
to upgrade to 1.4.2 and beyond, you'll need to upgrade to OS X Panther
(10.3). Apple does not plan to release any new versions of Java for
Jaguar.
If you have an earlier version of OS X and want to buy the latest 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 horizontal banner.
If you have installed the Developer Tools (XCode) software, get the
Java 1.4 OS Tools update that corresponds to your version of Java 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.
Folders and UW CSE Software Library
- Note: Use of UW CSE libraries will vary from quarter to quarter.
There may be additional libraries or files which need to be downloaded
for individual programming assignments. You don not need to install
the CSE libraries if your instructor is not using them.
- Be sure you have already installed the Sun Java 2 SDK first (see
above).
- Create a folder for the CSE142/3 files. On Windows, we strongly
recommend you use the name C:\CSE. It will make set-up much
easier. On the Mac, if you have installed the developer tools, we suggest
putting it in the Developer/Library directory. If you haven't installed
developer tools you can put it in your own Library or Documents folder.
- Download the following file and place it in your CSE folder: uwcse.jar
- Instructions for configuring DrJava 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 Eclipse 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) Click on the download windows app button. This
can be placed anywhere, but we suggest putting it in the C:\CSE\
directory.
- (Unix, and Linux) Click on the download jar file button
to get the .jar (Java archive) file containing DrJava. This file
can be placed anywhere, but we 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. If you have the developer tools
(XCode) installed, we suggest you put DrJava in the Developer/Applications folder.
If you haven't installed the developer tools, we suggest putting
DrJava in your Applications folder.
- Start DrJava.
- (Windows, Unix, Linux) On most of these systems, you should be
able to run DrJava by double-clicking on the drjava jar or application
file.
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.2_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 interactions window pane at the bottom of the
screen, 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, if your
class is using them. 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 uwcse.jar
that you downloaded above, 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 in the
interactions window.
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
some students have found it useful for larger projects, particularly in
CSE143.
- Be sure you have installed the Sun SDK or Apple Java update first.
You don't need to install DrJava or other tools to use Eclipse.
- Eclipse is available from www.eclipse.org.
We suggest installing the latest "3.0 stream stable build",
which is expected to be version 3.0M8 by the time spring quarter
starts. 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 moving the application to the Developer/Applications folder
(Mac OS X, if you have installed the developer tools), Applications (OS
X if you haven't installed developer tools),
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 your course.
Old School
Once you have installed the Java SDK on your home machine, you can actually
build Java programs without DrJava, Eclipse, or other tools. 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.
|