Compiling a Java Program

javac HelloWorld.java

In this phrase, we compile the HelloWorld.java source file to bytecode. Bytecode is Java’s platform-independent representation of a program’s instructions. The output will be placed in the HelloWorld.class file.

The javac executable is included with the Java JDK distribution. This javac program is used to compile the Java source files that you write into Java class files. A java class file is a bytecode representation of the compiled java source. For more complete information about the javac command, be sure to see the JDK documentation. There are many options you can use with javac that are not covered in this book.

For most programming projects, other than very small and simple programs, you will ...

Get Java™ Phrasebook 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.