Eclipse Quick Guide
Eclipse Quick Guide
Part 1: Getting Started with Eclipse Part 2: Working with Eclipse Part 3: Using Subversion (SVN) Useful Online Guides
Tuesday, 9 October 12
Installation & Running The User Interface Creating a Project Creating a Class Running a Project Navigating Projects
Tuesday, 9 October 12
Tuesday, 9 October 12
windows: eclipse.exe linux / os x: eclipse application in the lab: Root > opt > eclipse-3.7 > eclipse
Current Perspective
Editor
Output
Tuesday, 9 October 12
Tuesday, 9 October 12
Creating a Class
1
[right-click]
right-click on the location / package where you want to place this class can auto-generate main method stub
Tuesday, 9 October 12
Running a Project
In Eclipse: From command line:
Navigate to ProjectName/bin folder to execute If your project is packaged then from bin use java packageName/ className to execute
Tuesday, 9 October 12
Navigating Projects
Selecting an item in one view brings it into focus in the other views
Tuesday, 9 October 12
Creating Packages Automatic Code Generation Importing System Classes into Projects Importing System and User Libraries Debugging Refactoring Creating jars Other Useful Features
Creating Packages
1
By convention these are named in myPackage style, just like classes
If you move classes between packages Eclipse will automatically x references in other classes, and add import statements where needed
Tuesday, 9 October 12
select one, then [control+enter] to invoke it can x import declarations and most simple (non runtime) coding errors
Tuesday, 9 October 12
Tuesday, 9 October 12
Importing Libraries
1
This adds a JRE System Library
2 3
For other libraries we select Add External Jars then navigate as apt
Tuesday, 9 October 12
Debugging
Red warnings are items that might cause the program to fail to run
Yellow warnings are advisory: attributes, methods and imports that are never used non-generic Collection types in use:
Hover on the warning for info, use Quick-Fix where apt Runtime errors can be traced from Console to the guilty line of code in Editor:
Visit http://www.ibm.com/developerworks/library/os-ecbug/ for a guide to the more advanced inbuilt debugging features
Tuesday, 9 October 12
Refactoring
Eclipse can rename methods and attributes across the whole scope of a project [double-click] on a method or attribute name > Refactor > Rename Optionally, old methods can be retained and deprecated:
Tuesday, 9 October 12
Creating Jars
Tuesday, 9 October 12
[right-click] on project Export > Java > JAR File > Next select Export java source les and resources Name the JAR
Runnable JAR (source code omitted, but includes externally referenced libraries) [right-click] on project Export > Java > Runnable JAR File > Next Select Launch Conguration: Extract External Files Name the JAR
About Launch Conguration: Extract: external JARs will be extracted and the class les put/mixed together with your class les Package: external JARs will remain as JARs in the root of your archive
View the TODO list using the Task view, NOT the Task List view Click on an item to bring it to focus in other views
File Handling: the default working directory for les is the top level directory for the project, NOT the (src) directory containing the source code
Tuesday, 9 October 12
Installing Subversive Adding a New Repository Location Adding, Moving and Removing Content Sharing a Project Check Out Files and Folders Commit Changes Revert Changes Suggested Practice Exercise
Installing Subversive
Tuesday, 9 October 12
Tuesday, 9 October 12
Tuesday, 9 October 12
Move File:
[select-and-drag] as apt
Delete File:
[right-click] on le > Delete
Sharing a Project
1 2 3
do in Java view must refresh the SVN view to see it there easy to change projects location in SVN view
Tuesday, 9 October 12
Tuesday, 9 October 12
Commit Changes
Tuesday, 9 October 12
Tuesday, 9 October 12
a couple of classes will do then make a backup copy outside of your Eclipse workspace folder
share it to the team repository go to SVN Repository perspective and refresh the view move the project into sandbox delete the local copy of the project from your Eclipse workspace
now check out the project from the repository just the project, not the whole repository
go to Java perspective and make trivial changes to the code commit the changes try having a couple of team members simultaneously make changes (to different classes) in the project
Tuesday, 9 October 12
Tuesday, 9 October 12
http://www.vogella.de/articles/Eclipse/article.html