Chapter 3. The Java Virtual Machine and Platform

The Java language drew upon many years of experience with earlier programming environments, notably C and C++. This was quite deliberate, as James Gosling wanted a familiar environment for programmers to work within. It isn’t too much of an exaggeration to describe the Java language as “C++ simplified for ordinary developers.”

However, Java code cannot execute without a Java Virtual Machine (JVM). This scheme provides a suitable runtime environment in which Java programs can execute. Put another way, Java programs are unable to run unless there is a JVM available on the appropriate hardware and OS we want to execute on.

This may seem like a chicken-and-egg problem at first sight, but the JVM has been ported to run on a wide variety of environments. Anything from a TV set-top box to a huge mainframe probably has a JVM available for it.

In environments like Unix and Windows, Java programs are typically started by from the command line, e.g.:

java <arguments> <program name>

This command starts up the JVM as an operating system process. In turn, this process provides the Java runtime environment, and then finally executes our Java program inside the freshly started (and empty) virtual machine.

The Design of the JVM

The design of the JVM also drew on the experiences of its designers with languages such as C and C++ (but also more dynamic languages such as Lisp and Smalltalk). In addition, it took some bold steps to advance the state ...

Get Java: The Legend now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.