OOPortal OOPortal

Structured Programming   «Prev  Next»
Lesson 6 Java interpreter
ObjectiveUse the Java interpreter.
You have compiled your first Java program, so now you're ready to run it using the Java interpreter. This is a program that translates the bytecode produced by the Java compiler into machine instructions that your computer can understand.
Java interpreter: Runs a Java program. Translates bytecode into machine code for a particular machine.
To run a Java program using the Java interpreter that's included in the Java 2 SDK, you will issue the java command along with the name of the bytecode file of your Java program. For example, to run a Java application contained in the file HelloWorld.class you would issue the following command at the command prompt.
java HelloWorld

Note that a Java bytecode file is also commonly referred to as a class file. Also note that when specifying a class file with the java command, the .class extension of the dclass file is not specified (i.e., it is implied).
In the next lesson you will be introduced to some basic terminology from object-oriented programming.

Java helloWorld Windows - Exercise

Run the HelloWorld program (Windows)
Java helloWorld Windows - Exercise

Java HelloWorld - Unix - Exercise

Run the HelloWorld pogram (Unix)
Java HelloWorld - Unix - Exercise