Java Tutorial - lesson zero


Lesson Zero: Setting up your programming environment.

back to tutorial index - next lesson


Before we actually start programming, let me explain how to set up your own programming environment.

Once you have written your programming code, you cannot execute it on your computer directly. You will need to compile your code first. This is the same for almost all programming languages. The Java compiler compiles your code into so-called byte-code. This byte-code can be executed by the ´Java Runtime Environment´ (JRE). (The byte code can be executed in your own type of operating system as well as on other platforms like Windows, UNIX/LINUX or MacIntosh.)

The programming process in steps:
1. Open a text editor and a DOS/UNIX window.
2. Change the path in your DOS/UNIX window to the directory in which your programme is located.
3. Program or alter your code in the text editor and save it as Xxxxx.java .
4. Compile your code by typing ´javac Xxxxx.java´ in your DOS/UNIX window.
(This will translate the file Xxxx.java into Xxxx.class that contains the byte code.)
5. Run your compiled code by typing ´java Xxxxx´.
6. Return to step 3 to correct mistakes.
 

Remarks:
- I assumed you are programming a java application. If you are programming an applet, step 5 becomes: Run your code by typing ´appletviewer Xxxxx.html´. But I will get back to this subject in the lesson on applets.
- If the javac, java or appletviewer programme cannot be found, make sure that the path of your system includes the java\bin directory where these programmes were installed.
 

back to tutorial index - next lesson