eclipse project. installing visit to download a copy for your home computer –get release version...

17
Eclipse Project

Upload: damian-blankenship

Post on 18-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

Eclipse

Project

Page 2: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

Installing

• Visit http://www.eclipse.org to download a copy for your home computer– Get Release version 3.0 (or later)

• Eclipse is available on any of the machines in the CS Lab– Type ‘eclipse’ to run on queen– This is currently an older version, but much

of the functionality is the same• Note: This demo was done using Eclipse version 3.0 on Windows

XP

Page 3: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

Java Project…

• Menu File>New>Project• Select Java Project and click Next• Name it HelloWorld#userid# and click Finish• The jar files appear in the view

– Switch perspectives to Java if asked

• You can see two perspectives now on top-right of screen:

– Java

– Resources

– Switch to Resource perspective

» You will see .project and .classpath files in your project

Page 4: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

The Java Perspective

• Switch to the Java Perspective

• Check out these options in the perspective:

• Source Menu• Refactor Menu• Debug toolbar icon• Run• New Java Project• New Java Package

Page 5: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

Create a New Class

• Creating a new class – Right-click on HelloWorld in the

Package Explorer and select New> Class

– Make sure the Source Folder is Hello World

– Leave Package blank. – Leave Enclosing type unchecked. – Enter HeIloWorld#userid# in the

Name field.

Page 6: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

Creating a New Class

• Make sure public is checked, abstract and final are unchecked.

• Leave Superclass as java.lang.Object

• Leave interfaces blank. • Make sure public static void

main(String[] args) is checked. • Leave the other two unchecked. • Click Finish

Page 7: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

•Notice how you can add code templates to match your own coding styles, etc.

Page 8: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

Write the code for the new class

• Enter the following source code as your main() method. – System.out.println("Hello World!"); – Save– Review the source and the generated

class

Page 9: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

Running and Debugging

• Select HelloWorld.java if it is not already selected.

• From the main tool bar, select the Run tool's dropdown.

• Select Run ... Run As … Java Application

• Click on the Console window at the bottom to view the results of your application

Page 10: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

Create HelloWorld2

• Overview– You'll initialize a counter that you'll use

to control a loop – Run it without debugging – Later, using the debugger, go in and

modify the counter to make the program run differently

Page 11: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

HelloWorld2

• Copy HelloWorld source code• Create a new class called HelloWorld2• Paste the source code (make sure you

rename the class HelloWorld to HelloWorld2

• Modify the main method with the following sourceint count = 3; for (int i = 0; i < count; i++)

{ System.out.println("Hello" + i); }• Save

Page 12: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

HelloWorld2

Page 13: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

Break-pointing a program

• Right-click on the debug column to the left of the for loop.

• Select Toggle Breakpoint• View the Debug Perspective• Click Run>Debug As>Java Application• Double-click on the count variable in the

Variables view• Enter the value 5 and click OK • Click the Resume tool to continue

execution of the program

Page 14: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

CVS

• Switch back to the Resource perspective• Click Window>Open Perspective>CVS Repository

Exploring perspective • Right click on the Repository list and Select

New>Repository Location• To set up queen for personal CVS:

– ssh into queen– Create a cvsroot directory in your home directory– Run “cvs –d /home/xxx##/cvsroot init”

• Enter your CVS server information in Eclipse– connect to queen via extssh using– Host: queen.cs.drexel.edu– Repository path: /home/xxx##/cvsroot– Your userid and password– Say OK to any dialog boxes for new connections

Page 15: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

CVS

• Switch back to the Resource perspective• Right-click on your project, Select

Team>Share Project• Click Use existing repository location and

click Next– Make sure your queen account is selected

• Use the project name as the module name and Click Next

• Files will be added to repository, click Finish• Commit any other files and changes

– Make sure you add a comment to commit

• Files will be committed

Page 16: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

•Notice changes to file display•If you right-click on project or files and select Team, you will now have the ability to synchronize, commit, etc. with your CVS repository

Page 17: Eclipse Project. Installing Visit  to download a copy for your home computer –Get Release version 3.0 (or

References

• http://www.eclipse.org