O'Reilly logo

Java™ Phrasebook by Timothy Fisher

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

Running a Java Program

javac HelloWorld.java  // compile source file
											java HelloWorld  // execute byte code

In this phrase, we first use the javac compiler to compile our Java source into a HelloWorld.class file. Then, we can execute the HelloWorld program using the java command and passing the name of the compiled class, HelloWorld. Note that you do not include the .class extension when passing the name to the java command.

The java executable is included with either the Java JDK distribution or the Java JRE distribution. This program is used to execute your compiled Java class files. The Java executable can be thought of as the interpreter that compiles your bytecode real-time into executable native code that runs on the platform you are executing ...

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