How to build a project from the skeleton code in Eclipse

To get through all CS303 lab assignments, you don't need to be a guru of Eclipse. Basically, what you do for each programming problem is to

  1. Build a project.
  2. Import the skeleton code.
  3. Extend and save the code.
  4. Run the Java program under command line tool.

The details are illustrated below. (The warm-up exercise palindrome is used as a sample, but the procedures apply to all programming problems.) You can click on a icon to see the original high-resolution image.

Step Comments Illustration
Build a project

Download and unzip skeleton code.

It will create a folder named palindrome with skeleton code in it.

Open Eclipse.

In Workspace Launcher, accept default settings and click OK.

If Eclipse is run for the first time, a welcome page will be displayed. Click the Workbench symbol.

In the workbench, go to File - New - Project ... to start a new project.

In the New Project window, expand Java and select Java Project, then click Next.

In the New Java Project window, type in the project name palindrome and click Finish.

A Java project is created!

Import skeleton code

In Package Explorer panel, expand palindrome, right click on src and select Import ....

In Import window, expand General and select File System.

Click Browse ..., and locate skeleton code in the Import from directory window (Desktop\palindrome\palindrome\).

In Import window, click Select All and then Finish.

The skeleton code is imported!

Expand and save the code

In Package Explorer panel, expand palindrome - src - (default package) to see all the files included in the skeleton code. Double-click to view the content of the file in the main window. The places where you need to expand/edit are marked as TODO.

Implement all the TODOs and then save the project by pressing Ctrl+S. Eclipse will generate the class files under the workbench directory.

Your program is now ready to run!

Run your program

To run your JAVA program, go back to the desktop, and go to start - Run ....

In the Run window, type in cmd and then click OK.

Change to the project directory in cmd. In default settings, it would be C:\Documents and Settings\[BlazerID]\workspace\palindrome\bin\. It also can be tracked in Eclipse by going to Project - Properties - Resource - Location.

You will also need to make your input file to the program. You can do this by copying the example input from the web page and paste it to a NotePad file and saving it in the same directory as your program. In this example, I save the file as "testdata.txt".

In command line tool, type java PalindromeDetectorDriver testdata.txt output.txt to run the program.

If correct results are given in output.txt, then you are done! But be aware that your program may still have bugs and may fail some hidden test cases, so keep testing!