Friday, January 2, 2009

Eclipse Tutorial

Implement and Run a Welcome Program

  • Click the Eclipse Icon (this will create a new folder named workspace on your h: Drive where you will be storing your Java projects).
  • Eclipse will start and offer a Weclome page which you should close.
  • Create a new project by clicking on File > New > Project

  • Make sure Java Project is selected, and then click Next
  • Name your project with a name indicating a project that will contain all labs this semester: 1_Zac_Doe_Jane

  • Create a class with File > New > Class

· After Name: type the name of the class you want to create. For project 1, the first class you create will be called Welcome. After you type that in, click Finish (at bottom).

  • Select your file, delete the following comments, but leave the class heading and the main method stub


* Created on Jan 17, 2005


* TODO To change the template for this generated file go to

* Window - Preferences - Java - Code Style - Code Templates



* @author mercer


* TODO To change the template for this generated type comment go to

* Window - Preferences - Java - Code Style - Code Templates

  • Select your file and type in the following code as it is shown below (for now ignore the green comments at the top of the file). As you type, you may encounter squiggly red lines under portions of your code. This is the compiler telling you that you may have an error. To be sure, type the entire line as shown below. For help, look at the messages in the Tasks view under your program (or let the mouse hover over the error).

  • Once everything is typed in, save the file by going to File > Save (or Ctrl-S for short). Saving the file compiles the code into a class file and updates the error messages. Fix any errors you may have before you go on.
  • Next, go to Run >Run As > Java Application

  • At the bottom of the screen in the Console box, you should see some output that says

Welcome. What is your name?

  • Click on the console window to the right of this prompt
  • Type in your name and press the enter key
    • if you can't input anything, try clicking on the line below the prompt as you probably typed println rather than print. The program should respond with Hi your name. I hope you are doing well! If your program doesn't seem to be behaving properly, go back and make sure that you entered the code correctly and try it again.
  • The dialog should look like this:

Welcome. What is your name? Jane

Hi Jane! I hope you are doing well.



My Blog List