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.
Satisfy the dialog by providing sensible information about where you want your workspace etc. I suggest that you use a name like lab7 for the workspace you use this week. You may consider making a separate package for each exercise. It will make it easier for you to keep track of your stuff so you will be able to hand your work in neatly.
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. And it will create code identifying the package. 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 create this 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 lab7). 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.
If you're going to make a package called ex1 you'll see a dialog like this one:
Now within your package 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: