LAB EXERCISE 1: Installing JDK and Compiling/ Running a Java Program

A.     Download and Install the latest Java Standard Edition   Development Kit (JDK) on your PC.
NOTE:  If the JDK has been installed on the PC, proceed to Step B

1.   Accept the License Agreement

2.   Choose the production version
(i.e. Windows 8 will be the Windows x64 version,
       Windows 7 32 bit will be Windows x86 version,
       Windows 7 64 bit will be Windows x64 version)

3.  Once it is downloaded, install by double clicking on the jdk-8u201-windows-xxx.exe

4.  Accept the recommended default installation options

5.  Note: The installation directory of JDK will be in the C:\Program Files\Java\jdk1.8.0_201

B. Add the JDK bin folder path so Windows can find the Java Compiler and Interpreter

1.   Select Start -> Computer -> System Properties -> Advanced system settings -> Environment Variables

2.   Under System variables scroll down and select -> Path

3.   Click on the Edit button


4.  Append the following directory path to the end of the Variable value. 
If you installed JDK 8u201 on your PC,  type 
;C:\Program Files\Java\jdk1.8.0_201\bin

In the LMC Computer Lab PCs, JDK 8u201 was installed, type ;C:\Program Files\Java\jdk1.8.0_201\bin



5.  Click the OK buttons to close the windows.



C. Compile and Run the Java Program

1.  Create a folder on your desktop called “Calculator

2.  Download and save the zip file on your Desktop.


3.   Extract the and place the file into the Calculator folder.
Note: The file can be opened and viewed in Notepad. 
The Java program was created using the Integrated Development Environment (IDE) tool called Eclipse. This is the IDE tool we will be using when creating our Java Programs.

4.  Go to Start, Run and type cmd for the command window

5.  Go to folder you created by typing CD desktop\Calculator and press enter

6.  Type dir for the directory listing.  Verify the file is in the folder
NOTE: You can view the code of the in NotePad

7.  Compile the Java program. 
From the command line, type
javac and press enter

8.  Run the Java program.
From the command line, type
java –cp  . calculator and press enter

NOTE:  The Java application will launch.  Test the application.



D.  Submit your exercise in the Canvas Lab Exercise #1 Drop Box

1. Submit the screen shot of the application with your test data and the DOS window showing the command line you entered to run the Java program (see step C8#). 
NOTE: You can use Paint (save as JPG) or Word to paste the screenshot.

2.  Zip up and submit the compress Calculator folder. 
NOTE: Right click on the folder and select Send to “Compress Folder”.  The file will have a file extension of .zip