c omp 401 e clipse s etup graduate ta’s: wade gobel, ben newton

28
COMP 401 ECLIPSE SETUP Graduate TA’s: Wade Gobel, Ben Newton

Upload: prosper-alexander

Post on 29-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

COMP 401ECLIPSE SETUP

Graduate TA’s: Wade Gobel, Ben Newton

Page 2: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

2

ECLIPSE – ONE TIME SETUP

Mac and Windows have separate setup instructions

Once we begin using Eclipse, instructions are the same

Ask TA’s for help with any problems you encounter.

Page 3: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

3

WINDOWS USERS – SETTING UP THE WORKSPACE FOLDERS

Open “My Computer” Click on “Start” and then “Computer”

Open your “C:” drive Create a new folder called

“comp401workspace” Do not include the quotes in the name

Open the “comp401workspace” folder Leave the window showing the folder contents open

Page 4: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

4

WINDOWS USERS – SETTING UP THE WORKSPACE FOLDERS

From the recitation page of the course website, download Java and Eclipse onto your desktop For all the files, you must right-click and then

choose the “Save link as…” or “Save target as…” option

If you are using Internet Explorer Save the file to your desktop by clicking on the

desktop icon on the left-hand-side of the Save window

If you are using Mozilla Firefox Download the files to your desktop

Drag the files you save from the desktop to the “comp401workspace” folder you opened up earlier

Page 5: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

5

WINDOWS USERS – STARTING ECLIPSE

Unzip your downloaded Eclipse file, go to its extracted folder, and create a shortcut of the file “eclipse.exe” onto your desktop Right-click on eclipse.exe and choose Send to ->

Desktop Double-click on the Eclipse shortcut on your

desktop

Page 6: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

6

MAC USERS – SETTING UP THE WORKSPACE FOLDERS

Open your “Documents” folder Create a new folder called

“comp401workspace” Do not include the quotes in the name

Open “comp401workspace” folder Leave the window showing the folder contents open

Page 7: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

7

MAC USERS – SETTING UP THE WORKSPACE FOLDERS

From the recitation page of the course website, download Java and Eclipse onto your desktop For all the files, you must right-click and then

choose the “Save link as…” or “Save target as…” option

If you are using Safari or Mozilla Firefox Download the files to your desktop

Drag the files you save from the desktop to the “comp401workspace” folder you opened up earlier

Page 8: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

8

MAC USERS – STARTING ECLIPSE

Open your “Applications” folder Open the “eclipse” folder Double-click on eclipse.exe

Page 9: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

9

SETTING UP THE ECLIPSE WORKSPACE

From this point on, the instructions are the same for Windows and Mac users

Page 10: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

10

SETTING UP THE ECLIPSE WORKSPACE

When you first start Eclipse, you may see the Workspace launcher screen Browse to the comp401workspace you created Click OK

Page 11: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

11

SETTING UP THE ECLIPSE WORKSPACE

When you first start Eclipse, you may see the Startup tab If you do, you can close it using the “x” button for the tab

Page 12: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

12

SETTING UP THE ECLIPSE WORKSPACE

You should now see something like this

Page 13: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

13

SETTING UP THE ECLIPSE WORKSPACE

If you already have some other workspace open, you can switch between workspaces by clicking on “File” then “Switch Workspace” then “your target workspace”

Page 14: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

14

SETTING UP THE COMP401 PROJECT

Create a new Java Project by clicking on “File” then “New” and then “Java Project”

Page 15: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

15

SETTING UP THE COMP401 PROJECT

Enter the project name as “Factorial” Click Finish

Page 16: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

16

SETTING UP THE COMP401 PROJECT

You should see something like this (with “Factorial” instead of “comp401”)

Page 17: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

17

CREATE A JAVA PACKAGE

On the tool bar, select “File->New->Package” or click the “New Java Package” icon, create a package called comp401pkg

Page 18: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

18

ADDING A NEW CLASS

Right-click on “comp401pkg” then “New” and then “Class”

Page 19: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

19

ADDING A NEW CLASS

Call the class “Factorial” Do not change any other settings or enter other

information Click Finish at the bottom of the window

Page 20: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

20

ADDING A NEW CLASS

You should see something like this (your project name and class names will be different)

Eclipse has already made the class header for you You can now write the class body in the edit window

Page 21: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

21

RUNNING ASAFEARGPRINTER FROM ECLIPSE

Right-click on “Factorial.java” then “Run As…” and then “Java Application”(or Ctrl+F11)

Make sure you have finished the main method before running it.

Page 22: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

22

SPECIFY ARGUMENTS TO YOUR PROGRAM (REVIEW)

Right click on your Java file -> Run As -> Run Configurations -> Arguments

Page 23: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

23

COMPILING IN ECLIPSE

By default, Eclipse auto-compiles for you so you never have to

To turn auto-compile on or off, click on “Project” and then check or uncheck the “Build Automatically” option If it is checked, then auto-compile is on

Page 24: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

24

DEBUG YOUR PROGRAMS (1)

Debug Perspective (F11)

Switch Views

Page 25: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

25

DEBUG YOUR PROGRAMS (2)

Check this box.

• Add a breakpoint by right-clicking in the left ruler area, and select “Toggle breakpoint”• Start debug

Page 26: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

26

DEBUG YOUR PROGRAMS (3)

Watch

Code

Set breakpoints on the side bar

Step Into(F5) & Step Over(F6)

Page 27: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

27

ECLIPSE AND YOU

You have successfully setup Eclipse Later we will install the ObjectEditor package

needed for this class Feel free to explore Eclipse and use it for your

assignments from now on If you have any questions or problems about

Eclipse, feel free to ask the TA’s

Page 28: C OMP 401 E CLIPSE S ETUP Graduate TA’s: Wade Gobel, Ben Newton

28

SCREEN CAPTURES

Select the window you want to capture. Press Alt-Print Screen (Windows) or Command +

Shift + 4, then Spacebar (Mac) An image of the screen is in your copy buffer Paste into document for your assignment.