Before you can begin running Java programs in the lab, you should know a bit about how Java works. This will help you understand the compilation and interpretation phases of making Java programs.
Although Java programs are interpreted, they are also compiled. The Java interpreter understands so-called Java byte code which is more efficient to interpret than the Java code that you can read. So a Java program must first be converted from Java code to Java byte code before it can be run.
You should be aware there are two flavours of Java programs: applications and applets. The difference here is largely in what the interpreter allows the program to do. I mentioned before that Java is a popular language for the web; however there are security risks associated with running a stranger's code on your machine. To address this concern, a Java applet interpreter puts significant restrictions on what an applet can do. For example, it can't write files to your local file system and thereby erase possibly precious documents. Java applications, on the other hand, are designed to behave like any other program.
There are also differences in the environment applications and applets run in. Predictably, applications are designed to be run from the command line like other programs. Applets are run from within a web browser, such as Netscape. The browser reads an HTML file containing a reference to a Java applet and then runs it. (HTML is the document language for the World Wide Web - you are reading an HTML document now).
|3 Compiling Java Classes|