HelloWorld
Work on this exercise by yourself,
but ask questions of your instructor, student assistants and classmates as desired.
Goals
The goals of this exercise are to:
- Familiarize you with our development environment (Eclipse)
- Ensure that you can create a simple program from scratch
- Make sure that you are clear on very basic OOP structural elements
- Introduce you to creating a new project using Version Control
The Exercise
You will design, implement and test the famous HelloWorld program, using good OOP techniques.
You will add the HelloWorld project to a central repository using Subclipse.
Instructions Part 0 - Install Subclipse
Follow
these directions.
Instructions Part 1 - Create the Project
- Open Eclipse, and make sure the Package Explorer is visible in the left window.
- From the menus, select File → New → Project . This will bring up the New Project Wizard.
- Accept the default choice, "Java Project" and choose "Next"
- Name your project "HelloWorld". Accept the defaults, but notice that you are choosing to Create a New Project in Workspace.
If you don't know what a workspace is, now is the time to find out.
- Choose Next, and notice the folders (src and bin) that Eclipse is about to create for you
If you don't know what the src and bin folders are for, now is the time to find out
- Choose Finish and you should be back at the Eclipse Package Explorer.
What is different now? (observe, don't write)
Before you continue, minimize Eclipse and go find the folders for HelloWorld, bin and src . Unless you redirect your project workspace output, from now on all your projects will be created here.
Instructions Part 2 - Write and Execute the Code
- Write the code for HelloWorld....
Hint: Start by highlighting the src folder in the Package Explorer, and right-click to create a New → Class
Note: You should create one class and one method only in this project.
- Make sure it runs as a proper dignified HelloWorld program should, with output on the console - no GUIs.
To run, select in the Package Explorer the .java file containing main(), right-click, and choose Run as → Java application
Instructions Part 3 - Add the Project to Version Control
- Right click on the HelloWorld project in the Eclipse Package Explorer, and choose Team → Share Project
- Select the SVN Repository - we created this for the class to use.
If it gives an error, ignore it and choose Next.
- Select Create New Repository Location and choose Next
- Type as the URL: http://svn.cs.rose-hulman.edu/repos/<your username>
and choose Next.
- Accept the default to use Project Name as Folder Name, and select Next.
- Make sure to Select All in order to put all your project files under
version control
- Include a useful comment!!!! This is important for later on!!!!
- After you choose "Finish" you should see log file notes in the Eclipse console window that verify your success.
- Minimize or exit Eclipse and go look for your HelloWorld folder. Something is very different - a Green Check mark is on the folder, indicating that the folder and its contents are now part of the version control system.
From now on, when you want to modify this project, you will need to update your local copy first, in case anyone else has worked on the project. Then, after you make your changes, you will commit your changes back to the repository so other people can see them. Details on how to do all this in our next lab.
More detailed directions for further reference using version control in
Subclipse are stored
here.