Workshop: Running a Java Program
To run the Java program you have just created, you must use a Java interpreter such as java, the command-line tool included with the Java Development Kit. An interpreter makes the computer follow the instructions you gave it when you wrote the program.
To run a Java program, the command java is followed by a space and the name of the class file that contains the program. Although the class file's name includes the .class extension, this part of the name must be left off when running the program with the Java interpreter.
To see whether the Saluton program does what you want, run the class. If you're using the kit, go to the folder that contains the Saluton.class file and type the following at a command line:
Even though the program's filename is Saluton.class, don't include the file extension .class in the command, or the interpreter will fail with an error.
When the program runs, it should state the following:
If you see this text, you have just written your first working Java program. Your computer has just greeted the world, a tradition in the field of computer programming that's as important to many of us as caffeine, short-sleeved dress shirts, and the Star Wars films.