Eclipse Review

Chapter: Eclipse Review

Let's begin by firing up Eclipse. Do that by double clicking the desktop icon (Windows) or selecting the Eclipse icon from the dock (Macintosh).

You will be confronted with a dialog.


Exercise 1

Satisfy the dialog by providing sensible information about where you want your workspace etc. I suggest that you use a name like lab6 for the workspace you use this week. It will make it easier for you to keep track of your stuff so you will be able to hand your work in neatly.

You will not need to hand in anything for this exercise. Just do it, and ask your lab instructor for help if you have any doubts whatsoever about what you're doing.


So that you get comfortable with Eclipse I want you to create a program that will print your name and your current opinion of Eclipse. Let's begin by examining the program I want you to write:

public class MeAndEclipse {

        /**
         * @param args
         */
        public static void main(String[] args) {
                System.out.println("_________________");
		System.out.println("I ********* Eclipse");
        }
}

As we shall see, Eclipse will prepare some of these lines of code for you. You are responsible for replacing _________________ with your own name and for replacing ********* with words to express your opinion of the Eclipse IDE. You can substitute "love", "like", "dislike", "hate" or whatever you want to make your feelings known!

Here is a line-by-line breakdown of the meaning of the above program:

OK. Let's write our first program in Eclipse. You should have an Eclipse window open as well as the browser in which you are reading these instructions. You can use Alt-TAB (Windows) or Apple-TAB (Mac) to toggle between the windows. Do it now for practice.

When in Eclipse you will see a menu bar along the top including items File, Edit, Source ... Choose the "File" option and from that choose "New" and from that choose "Java Project". You will be presented with a dialog that looks like:

You can choose a name for your project (I suggest ex2). The appearance of the dialog should be a lot like mine. If boxes are not checked appropriately you should consult with the lab instructor to fix your configuration. Once you have given the name of your project you should be able to click the "finish" button.

Now within your project you are going to create your first program. From the "File" menu, again choose "New" but this time select "Class". You will name your class MeAndEclipse. Your dialog should look like:

Be sure to check the box that says you want a method stub created for public static void main(String[] args). When you click "Finish" you should see:


Exercise 2

Replace the auto-generated comment "// TODO Auto-generated method stub" with the two println statements given above. Then save (this will compile the program or inform you about any errors). Then Run your program. Congratulations!


rhyspj@gwu.edu