Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Eclipse Project 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 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 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 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. 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 •Notice how you can add code templates to match your own coding styles, etc. 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 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 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 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 HelloWorld2 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 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 CVS • • Switch back to the Resource perspective Right-click on your project, Select Team>Share Project Click Use existing repository location and click Next • – • 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 your queen account is selected Make sure you add a comment to commit Files will be committed •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 References • http://www.eclipse.org