Download presentation
Presentation is loading. Please wait.
Published byDamian Blankenship Modified over 9 years ago
1
Eclipse Project
2
Installing Visit http://www.eclipse.org to download a copy for your home computerhttp://www.eclipse.org –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
3
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
4
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
5
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.
6
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
7
Notice how you can add code templates to match your own coding styles, etc.
8
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
9
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
10
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
11
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 source int count = 3; for (int i = 0; i < count; i++) { System.out.println("Hello" + i); } Save
12
HelloWorld2
13
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
14
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
15
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
16
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
17
References http://www.eclipse.org
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.