Either use your IDE to compile Hello (if your IDE requires explicit compilation[3]) or compile it from the command line:
javac Hello.java See the sidebar for more information about the javac command. You should be in the directory where you saved Hello.java. If all went well, you will see no messages from the compiler. If you mistyped something, you will likely receive compilation errors. For example, you might see: Hello.java:4: ';' expected } ^ 1 error This specific error means that you forget to type the semicolon (;) at the end of the third line of text. You might see multiple errors, depending on what you mistyped. Correct any errors and try to compile the file again. If you still have problems, make sure your code looks exactly as it appears above. Finally, see the section Still Stuck? at the end of this chapter. A successful compilation of Hello.java will produce the file Hello.class. Execute a dir or ls command to produce a directory listing and ensure that Hello.class exists. Hello.class is the binary compiled version of the source codethe class file. Hello.class is what the Java VM will read and interpret in order to execute the code you typed in Hello.java. |