Java Reference
In-Depth Information
Chapter 1. Getting Started: Compiling,
Running, and Debugging
Introduction
This chapter covers some entry-level tasks that you need to know how to do before you can
go on—it is said you must crawl before you can walk, and walk before you can ride a bi-
cycle. Before you can try out anything in this topic, you need to be able to compile and run
your Java code, so I start there, showing several ways: the JDK way, the Integrated Develop-
ment Environment (IDE) way, and the build tools (Ant, Maven, etc.) way. Another issue
people run into is setting CLASSPATH correctly, so that's dealt with next. Deprecation warn-
ings follow after that, because you're likely to encounter them in maintaining “old” Java
code. The chapter ends with some general information about conditional compilation, unit
testing, assertions, and debugging.
If you don't already have Java installed, you'll need to download it. Be aware that there are
several different downloads. The JRE (Java Runtime Environment) is a smaller download for
end users. The JDK or Java SDK download is the full development environment, which
you'll want if you're going to be developing Java software.
Standard downloads for the current release of Java are available at Oracle's website .
You can sometimes find prerelease builds of the next major Java version on http://java.net .
For example, while this topic's third edition was being written, Java 8 was not yet released,
but JDK 8 builds could be obtained from the OpenJDK project . The entire (almost) JDK is
maintained as an open source project, and the OpenJDK source tree is used (with changes
and additions) to build the commercial and supported Oracle JDKs.
If you're already happy with your IDE, you may wish to skip some or all of this material. It's
here to ensure that everybody can compile and debug their programs before we move on.
Search WWH ::




Custom Search