Verifying Installation

  1. If you are in the welcome screen, click on the Workbench button on the right side of the screen. Create a new project by going to File -> New -> Project
  2. A New Project dialog will appear. Expand java and select Java Project. Then click Next.
  3. Type in a name for the project, such as VerifyEclipseJava. Within the Project Layout section, select Use project folder as root for sources and class files and click Finish. Click Yes if prompted to open Java perspective.
  4. Right-click on the VerifyEclipseJava folder in the Project Explorer and go to New -> File.
  5. For the new file name, type VerifyEclipseJava.java, and click Finish. A new file will be added to the project and opened for editing.
  6. Type in the following code and save it when you're done.

    import java.io.*;

    public class VerifyEclipseJava {
    public static void main(String[] args) {
    System.out.print("Please enter your name: ");
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String name = null;
    try {
    name = br.readLine();
    } catch(IOException ioe) {
    System.err.println("Your name could not be read.");
    System.exit(-1);
    }
    System.out.println("Welcome to CSE 12, " + name + "!");
    }
    }

    After you copy the code to your editor, select all (Ctrl + A) and press Ctrl + Shift + F to automatically format the code.

  7. Run your project by going to Run -> Run As -> Java Application.
  8. The output should show up in the Console view. Type in your name and press <enter>.

    Congratulations, Eclipse has been successfully installed and verified to work with Java.

Congratulations, you have successfully installed Eclipse for Java! Note that the Eclipse just installed cannot be used for C/C++ projects. To program in C/C++ in an IDE environment, either choose the CDT add-on for Eclipse, or the Visual C++ environment. See the guides here

Please proceed to the next guide,
Using Eclipse for CSE 12 Homeworks