Title: Comp 110 Recitation 1 Java Installation
1Comp 110Recitation 1Java Installation
- Instructor Sasa Junuzovic
2Agenda
- Questions
- Announcements
- Software Installation
- Bare-bone environment
- Running the First Java Program
3Announcements
- Honor Code Pledge
- Check Assignments on Blackboard to sign the
Pledge - Office Hours
- M 430-530, Th 200-300
- Or by appointment
- Class Notes
- Now available for Theater Model of a Computer
- LiveMeeting
- Access to Live Meeting and the recordings will be
available to you - Assignment 1 handed out today
4Software Installation What do we Need?
Use basic text editor such as Notepad
Source Code
In Java, this requires running javac
Compiler
We will use two other tools for now
Console Window Command Prompt
Platform Independent Intermediate Code
ObjectEditor Driver
Interpreter
In Java, this requires running java
Platform Specific Machine Code
Processor
5Software Installation
- For those of you who were in class on Friday Aug
24, 2007 - If you were able to bring successfully load the
ObjectEditorComp110 program (shown below) then
your installation is complete. You do not have to
go through the rest of the slides in this
presentation.
6Software Installation
- Assumption You have Windows XP and are using
Mozilla Firefox to browse the Web - There are separate instructions for Mozilla
Firefox users and/or Mac users
7Java Installation
- Open the Following Website in Firefox
- http//java.sun.com/javase/downloads/
- Click the Download Button for JDK 6 Update 2
8Java Installation
- Select the Accept option to continue
9Java Installation
- Click on the Windows Offline Installation link
10Java Installation
11Java Installation
- File should have been downloaded to the location
stated here
- In this case, it was downloaded to the desktop
- We assume that it was downloaded to your desktop
from now on
12Java Installation
- When download completes, run the
jdk-6u2-windows-i586-p.exe file - On the first screen, press Accept
13Java Installation
- Press Next on the following screen
14Java Installation
- Press Next on the following screen
15Java Installation
- Uncheck the Show the readme file
- Click the Finish button
16Setting Up The Environment
- Click Start
- Right-click on My Computer
- Click on Properties
17Setting Up The Environment
18Setting Up The Environment
- Click on Environment Variables
19Setting Up The Environment
- Find the Path variable in the list on the
bottom of the screen - Click the Edit button
20Setting Up The Environment
- At the end of the Variable value field, enter
the following (including the quotes) - C\Program Files\java\jdk1.6.0_02\bin
- Do not forget the at the start
- Do not forget the double quotes
- Click OK three times to get out of the windows
you have opened
21ObjectEditor Installation
- Open up a command prompt window
- Click on Start, then Run
- Type cmd (excluding the quotes) and press Enter
22ObjectEditor Installation
- In the command prompt window, you will do three
operations. Please keep in mind these two rules - Rule 1 Do not enter any double quote characters
- Rule 2 Type the exact text shown below. In
particular, the case must match, and pay
attention to the / and \ characters as they
mean different things.
23ObjectEditor Installation
- Operation 1
- In the command prompt
- Type cd \
- And press Enter
- The only text on the bottom most line should be
C\gt
24ObjectEditor Installation
- Operation 2
- In the command prompt
- Type mkdir comp110
- And press Enter
- You should see C\gt on the bottom line and no
errors
25ObjectEditor Installation
- Operation 3
- In the command prompt
- Type cd comp110
- And press Enter
- You should see C\comp110gt on the bottom line
and no errors
26ObjectEditor Installation
- Go to the course webpage
- http//www.cs.unc.edu/sasa/teaching/fall2007/comp
110 - Right-click on ObjectEditor
- Select Save Link As
- Save it to c\comp110
- To do so, follow the next four slides
27ObjectEditor Installation
28ObjectEditor Installation
29ObjectEditor Installation
30ObjectEditor Installation
31ObjectEditor Installation
- Go back to your command window, type dir and
press Enter - You should see oeall3.jar listed in the output
- If there is no oeall3.jar listed, then carefully
re-download oeall3.jar from the course webpage.
32ObjectEditor Installation
- Go to the course webpage
- http//www.cs.unc.edu/sasa/teaching/fall2007/comp
110 - Right-click on ObjectEditorComp110
- Select Save Link As
- Save it to c\comp110, just like you did
oeall3.jar
33ObjectEditor Installation
- Go back to your command window, type dir and
press Enter - You should see oeall3.jar and ObjectEditorComp110.
java listed in the output
- If either is missing, then carefully re-download
the missing one from the course webpage.
34Compiling Your First Java Program
- Go to your command prompt window
- NOTE Make sure you are in the comp110
directory - You are if the text on the bottom line of the
command prompt window contains exactly
c\comp110gt - If you are not in the comp110 directory, do the
following - Type cd \ in the command prompt window and
press Enter - Type cd comp100 in the command prompt window
and press Enter
35Compiling Your First Java Program
- Compiling
- In the command prompt window, enter the following
(excluding the quotes) - javac -classpath oeall3.jar .java
- Press Enter
- There should be no errors reported. If there are
check the slides at the end of the presentation
which provide solutions to possible compile errors
36Running Your First Java Program
- Running
- In the command prompt window, type the following
- java classpath .oeall3.jar
ObjectEditorComp110 - Do not forget the . just before oeall3.jar
- Press Enter and the following window should
appear - If there are errors in the command prompt window,
see the slides at the end of the presentation for
solutions
37Running Your First Java Program
- Finished
- Congratulations, you have successfully installed
Java and ObjectEditor - The remaining slides are only for handling errors
encountered during the installation
38(No Transcript)
39Problems and Solutions
40Possible Compile Errors
- If you get the following error message
- javac is not recognized
- Verify that the following folder exists
- C\Program Files\java\jdk1.6.0_02\bin
- You can use Windows Explorer to see if it exists
- If it does not exist, you must follow the steps
for installing Java - If it exists, then you must follow the steps for
setting up the environment
41Possible Starting Errors
- If you get the following error message
- You must repeat the steps for Compiling Your
First Java Program
42Possible Starting Errors
- If you get something similar to the following
- You need to re-download the ObjectEditor from the
course webpage - Make sure you download it to the c\comp110
directory - You can overwrite the one already in the directory
43Possible Starting Errors
- If you get the following
- Check the spelling of the command
- Make sure you have the correct case. Here,
Objecteditorcomp110 should be ObjectEditorComp110
44Possible Starting Errors
- If you an error stating something about not being
able to open a zip file, then please download
oeall3.jar again - You can overwrite the one you already have