Java Resources
Java Compiler and Documentation
The most popular compiler for Java is the JDK compiler from Sun. You need version 5.0 or better of the JDK. You can find out which version is currently installed in the Computer Science department by typing the javac -version and java -version commands. You can get the JDK from the main Java site:
Main Java site (Java for Windows, Linux, Solaris)
You need to look for several things, in order.
- The Java 2 Platform is the second generation of the general Java system. The Java language itself changes with each release of the compiler, so people usually talk about "Java version 5" (or "Java version 1.5") rather than "Java version 2".
- J2SE version 5 is the Standard Edition of the Java platform, which is what you want for normal application programs or Web applets. There is also the J2EE, Enterprise Edition, which extends J2SE with Web-server stuff, and the J2ME, Micro Edition which strips it down for small devices like mobile phones.
- JDK version 5 is the Java Development Kit, part of J2SE, which means the compiler and related tools, and this is what you should download. It includes the JRE, Java Runtime Environment, which is all you need on its own if you only want to run programs and not compile them. The JDK was briefly called the J2SDK, but has now reverted to JDK by public demand.
- The tools, particularly javac and java, version 1.5. These are what you get when you download the JDK. The version 1.5.0 of the J2SE and JDK has been renumbered to version 5.0 (presumably at the insistence of marketing people) while the 1.5.0 version numbering is to continue within the tools themselves (presumably at the insistence of developers). There is a page within the documentation which "explains" this madness. And by the way, it is also known as the "tiger" version (its pre-release codename) in parts of the documentation.
The Java site is a "magazine" site, i.e. it changes frequently which can make it difficult to find what you want. At the time of writing, you follow the link to J2SE, then J2SE 5.x (under "popular downloads", or the right), then choose to download JDK and follow the download instructions. (Don't download the netbeans IDE, or the JRE, or source code).
Follow the installations instructions carefully, especially the bit about changing the PATH environment variable, so that you can use the javac and java commands from any directory.
You may also want to download the Java documentation. This is essential if you want to be able to use Java without being online. It contains the "Java Platform API Specification" (ie library documentation) which is vital to refer to while programming. It also contains a useful demo collection and pointers to the language specification, a style guide, etc, etc. If you are online, you can view the documentation on the main Java site:
Java 5 API Documentation
It is strongly suggested that you do not download or use any IDEs (Integrated Development Environments) until you regard yourself as a Java expert. See later for IDE information.
Learning Java
The JDK provides the commands javac Prog.java for compiling programs, java Prog for running programs, and subsidiary commands such as appletviewer, jdb and javadoc. On a PC, you have to run these from a DOS prompt. For information about an IDE (window-based Integrated Development Environment), see below.
There are lots of good and bad books on Java. One of the good ones is the one by Horstmann, which has a supporting web page at:
"Computing Concepts with Java Essentials"
by Cay Horstmann, 3rd edition, Wiley.
There are online beginner's tutorials, not so good, if you prefer. One is:
Brewing Java (University of North Carolina)
The so called "Java Tutorial" is a book with an online version:
The Java Tutorial
It is badly named because it is not a beginner's tutorial for the Java language, but rather an advanced tutorial for the Java libraries. However, it contains lots of useful information about how to use the advanced features of the libraries, and contains a lot of (complex) example programs from which you can extract code or information. It is best viewed directly at the Java site so you get the most up-to-date version (though it can be downloaded for quicker access):
Java Editors and IDEs.
On the whole, using IDEs (Integrated Development Environments) is not
recommended for Java beginners. They add significantly to the learning curve,
concentrate on the wrong issues, distract you from object oriented design, use
a lot of resources, prevent you from using your favourite editor, and often
decrease productivity, unless you are a full-time developer. However,
if you like IDEs, here are a few choices. First, some big full-featured IDEs
- Eclipse is the best, in my opinion, and
is installed in the department. It is open source, written in
Java, has a solid polished feel, and is extremely customisable, with a
wide variety of plug-ins. It has JUnit built in.
- Netbeans is popular, and supported by Sun.
- JBuilder is popular, but not free. You can get a free trial version, or check with the Computing Service.
- CodeWarrier is an example of a commercial IDE supporting C and Java.
- JCreator may be OK. It is written in C++ (not as portable as if written in Java, but faster on some systems) and has some Haskell support (see http://www.students.cs.uu.nl/people/rjchaaft/JCreator/)
- BlueJ is very different but very good for small programs, and promotes object-oriented design, and is used in several of the textbooks. The download file is a .jar file which gets corrupted by some browsers, so use the ftp download option for safety.
- Emacs is just a text editor but has syntax highlighting and triggering of compiler commands. It works best on Unix, but not so well on Windows. It is highly customisable, but customisation is complex.
- Textpad is also an editor with programming support, It is Windows only, and shareware, but quite good.
- JEdit is a free editor, platform independent, but a bit slow.
- Ultra Edit is Windows only, shareware.
Even without an IDE, you can customise your own environment to increase your productivity in a number of ways, e.g.
- use a shell which supports arrow keys and editing of previous command lines
- in Windows, associate the javac command with the .java filename extension so you can right click and choose compile, as well as double click to edit
- in Windows, associate the java command with the .class filename extension so you can double click on a program to run it.
- Use JSwat or similar tools.

