Download EclipseDemo

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Eclipse Practice Exercise - CSCI 230
[1].
Creating a new project
 Go to the Java Perspective
o Windows > Open Perspective > Java
 Create a new project called CSCI230.TestProject.YOURUSERNAME
o check the “Create separate folders for source and class folders” under project
layout
 Place a package in it called edu.csbsju.cs.YOURUSERNAME
o Place a class in the package called SimplePrint
o Check the box to create a stub for main method
o Add an interface (e.g. ActionListener)
o Check the box to Generate comments
 Write a println statement in method main
o Notice that compiling is done automatically while coding
 Right click on the java class file (.java)
o Select Run As  Java Application
 Change the main method to use a loop to print all command line arguments passed by the
user (i.e. args[0], args[1]…)
o Notice that as you do an error, the following can help
 Pressing F2 (Eclipse tells you what is wrong)
 Pressing CTRL and SPACE (Eclipse suggests solutions)
 Right click on the java class file (.java)
o Select Run As  Run Configurations
o Click on the Arguments Tab
o Specify a parameters under “Program arguments” separated by spaces or
lines
o Click on Apply then Run
 Add the following two attributes to your class: String name and int age
o Select Source  Generate Getters and Setters
o Look at your code
o Select Source  Generate Constructor Using Fields
o Look at your code
[2].
Migrating a new project to Eclipse (THIS IS JUST FYI…don’t try it unless you actually have a project
that you’d like to migrate to eclipse)
 Place all of your source files in a src folder inside your project folder
 Create a bin folder
 Create a new project
 Type project name
 Select “Create project from existing source”
 Browse and select your project folder
 Now your project works as if it has been created within Eclipse but it may not be under
your workspace
[3].
Creating a Connection to a CVS server a new project to Eclipse
 Select the CVS Repository Exploring perspective
 Right click in the CVS Repositories view
o New > Repository Location …
 Fill out form
o Host: unix.csbsju.edu
o Repository path: /home/cvs/CS230S10
o User: YOUR LINUX USERNAME
o Password: YOUR LINUX PASSWORD
o Connection type: extssh
o Check Validate connection on finish
[4].
Importing a project to CVS
 In the Java Perspective, right click on the CSCI230.TestProject.YOURUSERNAME
project
o Team > Share Project
o Select CVS location
 In the Share Project Resources
o Can instruct CVS to ignore files and folders in the given project using its
.cvsignore
 Highlight files to be ignored (Press Ctrl key while selecting & then Right
click on them)
 Select add to .cvsignore
 Notice the .cvsignore file added to the parent folder containing the
ignored resource (s) (Can be edited)
 Note that each subfolder must have its own .cvsignore file  if you
need to ignore resources having the same name but in subfolders  step
must repeated for individual subfolders
 Don’t ignore the .project files
o Click on Finish
o Add comment “This is project X release Y”
o Click on Finish
[5].
Checkout a module from CVS
 File > Import > CVS - Projects from CVS
 Choose the correct CVS location
 Select Use an existing module …
 Select Check out as a project in the workspace CSCI230.TestProject.YOURUSERNAME (provide different name if desired)
 Check Use default workspace location
 Click on Head
 Click Finish