# Java Notes

# Java Development Kit (JDK)

The most popular Java compiler is Sun's Software Development Kit (JDK) (aka Software Development Kit (SDK)). It's free, and does a good job. The only problem is that the compiler is only a compiler - there is no editor and no graphical user interface. It is typically used in one of the following ways.

- From the DOS command window with the `javac` command.
- With a program editor (eg, TextPad) which has an interface to the compiler.
- With an IDE (Integrated Development Environment). See IDEs.

## Free Download

Download only the Java Standard Edition (SE) JDK from java.sun.com. There are three editions - get the "standard edition", not the Enterprise Edition (EE) or Micro Edition (ME).

- Java SE - Java 2 Standard Edition - You want this.
- Not Java ME - Java Micro Edition - This is for phones, PDAs, etc.
- Not Java EE - Java Enterprise Edition - You don't want this unless you're doing Java client server programming, and even then, you probably don't need it.
- Maybe the JRE - Java Runtime Environment - This is used to run Java programs, and altho it was installed automatically with the JDK in the past, it didn't install with JDK 6. You should probably install this. On Windows, look in `C:\\Program Files\Java\` to see if there is a JRE for Java 6 (or later).

If you're a Macintosh user, it might already be installed on your system. Look at Java for Mac OS X.

## Installation

Installing the JDK is easy (at least in Windows). Just follow the prompts.

## CLASSPATH

If you're using commands from the DOS command window, you will probably have to set CLASSPATH. See CLASSPATH.

## JVM runtime `-enableassertions` (`-ea`) option

Command | Effect
--- | ---
`java MyProg` | Assert statements are removed by class loader.
`java -enableassertions MyProg` | Assert statements are executed.
`java -ea MyProg` | Short form for allowing assertions.

It's also possible to enable/disable assertion checking at runtime for individual classes or for library routines, but that level of control is not useful for most purposes.