This course uses Java version 1.5.
As part of autotesting your assignment submissions, we will recompile your work and run it. When we do that, we'll use Java 1.5 -- also known as 5.0. The textbook also discusses Java 1.5, and we will discuss some of the changes in version 1.5 during lectures. If you want to work at home, you should also use version 1.5. of Java.
Windows users
You need two things: a Java compiler such as J2SE v 1.5, and DrJava.
-
Sun's JDK 1.5. That takes you to a page where you can download the J2SE Development Kit 5.0. Select "Download JDK 5.0". You don't need to download NetBeans, but you do need the JDK, not the JRE. Warning: this is a big download!
-
DrJava. Download the Jar file or the Windows App (for the "Current Stable Release").
Mac OS X users
You already have Java installed on your Mac, but make sure you have Java 5.0 (or Java 1.5, which is the same thing).
You need DrJava. Download the Jar file or the Mac OS X App (for the "Current Stable Release").
If you have more than one version of the JDK on your computer, you may need to change the order they are considered so that Java 5.0 is first. Use the "Java Preferences" utility, under "Java" in the Utilities folder.
Other operating systems
You need two things: a Java compiler such as J2SE v 1.5, and DrJava.
-
Sun's JDK 1.5. That takes you to a page where you can download the J2SE Development Kit 5.0. Select "Download JDK 5.0". You don't need to download NetBeans, but you do need the JDK, not the JRE. Warning: this is a big download!
-
DrJava. Download the Jar file (for the "Current Stable Release").
A common DrJava problem: finding tools.jar
(This is an old answer -- it still refers to Java 1.4 -- but the problem may still arise.)
Question:
I downloaded Sun's J2SE JDK and DrJava. When it came to actually running DrJava, the following window kept popping up even though somehow DrJava still managed to run without me finding the file:
Compiler not found. The file you chose did not appear to contain the compiler. Would you like to pick again? The compiler is generally located in 'tools.jar', in 'lib' subdirectory under your JDK installation director. (If you say 'No', DrJava will be unable to compile programs.).
Answer:
First, make sure you installed the Java JDK, not the JRE. (See above.)
Now you need to find a file called "tools.jar". If you're using Windows, then when you installed the JDK, you probably put it in "Program Files". The name of the Java folder is probably something like "j2sdk1.4.0_01"; look inside that for a directory called "lib", and inside "lib" look for "tools.jar".
Java
Here are some general Java resources, including documentation.
-
Here are some articles about unit testing that you might find interesting:
-
The JUnit website.
-
Creating JUnit test cases: the first 6 paragraphs (to the end of the "Creating test cases" section) are pretty easy reading and introduce the philosophy of JUnit fairly well.
-
JUnit Cookbook: the first two sections might be quite helpful.
-
-
A very nice Java glossary. (Very useful!)
-
Documentation for the Java API (Very useful!)
-
Online Java language tutorial.
-
Tutorial on Java generics -- the <Blah> stuff that's new in Java 1.5. This tutorial goes farther than you need for CSC 148/A48, but you may find it helpful.
-
How to use javadoc to document your Java programs.
-
Code Conventions for Java, a comprehensive set of guidelines on programming style. The style rules for assignments are based on this, but we provide the link here mostly to show you that style is considered Really Important in the real world.
Java Software (some of it free)
-
Here is a page for Linux Java tools.
-
Here is a page for general (Windows and Mac) Java tools.
-
Here is a rather overwhelming list of Java resources, both free and commercial.
-
Here is a page of reviews of Java-related products by the online magazine JavaWorld.