Install the Java Programming Language
“Java” isn't just one application—it's actually several. There's the Java com-
piler, javac , the Java program runner, java , and the archiver utility, jar . javac
takes your text file and creates a magical pile of gunk it calls a class file . You
run the java command and tell it to use that pile of gunk, and your program
springs to life. We'll look at that process in more detail as we go along, but
that's the gist of it.
You might have Java installed already. Try running the Java compiler, javac ,
and see if it's there:
$ javac -version
Yup, it's installed on my machine, version 1.7. If it was not installed, I'd get
a message like this:
$ javac -version
bash: javac: command not found
You might also want to check that your java is indeed the same version as
your javac (it should be, but things happen):
$ java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
If you need to install Java, you'll want the Java Development Kit Standard
Edition (JDK SE) version 7 or later, which you can download for different
operating systems. 3 Depending on your operating system and vendor, you
may or may not have Java installed yet, you might only have java and not
javac , or you might have a slightly different version. Again, you'll need Java
JDK 1.7 or later to work with the examples in this topic.
No matter which operating system's installer you use, I heartily recommend
you accept all the default answers to any installer questions, especially for
the install location. Java and its associated programs can get more than a
little quirky and fussy if things aren't where they expect.
So go download the Java Development Kit (JDK) installer and follow its