4.1 The Java Compiler
The Java Compiler
If you are working on a Windows computer (God forbid), we'd like to take this opportunity to convince you to change to a Linux system. If you're still unconvinced, you can find the information you need on the Java compiler for your computer here.
As explained in the previous page, Java programs must be compiled before they can be run, and there is a Java compiler available on all computers on which the Java SDK has been installed. On a Linux computer the Java SDK will probably have been installed by default when the system was installed; if this is not the case you will have to consult your system documentation to see how to install Java on your computer. Once installed Java should automatically be accessible from the terminal command prompt.
Java is a command-driven language, which means that you have to drive it from the terminal / console - also known as the command prompt on some systems such as Windows. As a Linux user you will be familiar with the terminal or console. To check that Java is properly installed and working type the command
java followed by a space, followed by the option argument
-version at the command prompt. Hit the 'Enter' key, and you should see something similar to the image below:
If this is what you see, then you have no problems - Java is ready to roll.
PLEASE NOTE! Rule number 1: Java is caSe sEnsiTivE! This is what happens if you forget this rule:
OK - all's well with the Java executables; let's forget them for a little while and go to take a look at a first Java program.