O'Reilly logo

Programming for the Java™ Virtual Machine by Joshua Engel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Inside a Java class File

Your first Java program probably looked something like this:

public class hello
{
   public static void main(String argv[])
   {
      System.out.println("Hello, world");
   }
}

You ran it through the Java compiler

> javac hello.java

to create the file hello.class. Then you ran the program

> java hello
Hello, world
>

and exulted in having mastered another programming language.

The hello.class file contains a Java virtual machine bytecode class that produces the intended effect of hello.java. The file hello.class is called a class file. The class file format is described in chapter 4 of The Java Virtual Machine Specification. All JVM implementations are required to treat this file in the same way. This is the heart of the “Write ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required