Java Reference
In-Depth Information
Table 1-4.
JVM-Based Web Frameworks
Web Frameworks
Language
Download From
Struts 2
Java
Spring Web MVC
Java
JSF 2
Java
Grails 2
Groovy
Play 2
Java and Scala
Now that you have looked at the three key players that join forces in building modern Java web
applications (the JVM languages, Java EE, and the Java web frameworks), it is time to delve into
some specifics about Java.
The following section introduces Java so you can build your first stand-alone Java application. Since
this topic is centered on web development using Java and is not about Java as a programming
language, the introduction to Java is brief—it's just enough to help newcomers to the language
follow the subsequent chapters.
Getting Started with Java
A
Java
application
is a computer program that executes when you use the
java
command to
launch the JVM. In the Java programming language, all source code is first written in plain-text
files (in Notepad, for instance, or in any text editor) with the
.java
extension. The source files are
compiled by the
javac
compiler into
.class
files that contain bytecode instructions. The JVM reads
these bytecode instructions and translates them into the machine-language operations that each
computer executes. By making the JVM available on many platforms, Sun transformed Java into a
cross-platform language. As shown in Figure
1-6
, the very same bytecode can run on any operating
system for which a JVM has been developed.
JVM for Windows
Java program
Java compiler
Bytecode
JVM for Unix
JVM for Linux
Figure 1-6.
Cross-platform Java
Because the JVM is available on many different operating systems, the same
.class
files are
capable of running on Windows, Unix, Linux, or Mac OS. In the section that follows, I will show you
how to compile and run your first Java application. But first you need to set up the development
environment.