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.
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
Note: Oracle will require to sign-off to
download
You can also download from my website the JDK for Windows10 64bit
1. Accept the License Agreement
2. Choose the production version
(i.e. Windows X64 Windows 10 64bit),
3. Once
it is downloaded, install by double clicking on the
jdk-8u261-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_261
B. Add the JDK bin folder path so Windows can
find the Java Compiler and Interpreter
1. Select Start -> Windows Settings -> Type
Environment
Variables
2. Under Environment, select Path
3. Click on the Edit button
4.
Add the JDK bin folder path.
Select Browse and locate the JDK\bin
folder in your C:\Program Files\Java\
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 calculator.zip file on your
Desktop.
http://51.jmistal.com/Assignment/Exercise-01/calculator.zip
3. Extract the calculator.java and place the file
into the Calculator folder.
4. Open the source file- calculator.java file
use Notepad.
The Java program was created using the Integrated Development Environment (IDE)
tool called Eclipse.
Eclipse will be he IDE tool we will be using to create Java Programs during the
course.
5. Go to
search and type cmd
for the command window
6. Go to folder
you created by typing CD desktop\Calculator and
press enter
7. Type dir for the
directory listing. Verify the calculator.java file is in the folder
NOTE: You can view the code of the calculator.java in NotePad
|
8. Compile the Java program.
From the command line, type javac calculator.java and press enter
9. 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