The Java Development Kit ( JDK 1 by pzs15406


									The Java Development Kit

This contains the compiler to convert java source code to byte code, and the interpreter to
convert bytecode to machine language.

It is installed on each machine in the labs.

In the lab this week you will first create a directory ca591 on your h: drive into which
you will copy my sample programs and also the programs you create. Instructions for that
step will be given in your lab instructions. The notes below illustrate the compile stage .

Compiling the program


note after this operation there will be a file AddNumbers.class on your directory

       Java source
     Java Source Code                   Java Compiler
       Code                                                            Java bytecode

Running your program
java AddNumbers

The java interpreter looks for the file AddNumbers.class and interprets and executes it

                                          Java Interpreter
       Java Bytecode
       Addnumbers.class                                                  Machinecode

Note the result of the execution - the output from your program.

 When calling the compiler you have a c at the end of java
   When calling the interpreter no c

The program

Step through the code of the program and note what happens when
the program is executed.

Creating a source file
We can use any simple text editor. In the example below notepad is used. You will find it in the
accessories menu. In the lab you can use an editor called EditPlus which highlights java key
words. Details will be given in the handout in the lab on Wednesday.


To top