ICS 111 - Introduction to Computer Science I - Lab

IntroductionContact your TAEclipse SetupSSH Setup / UseWebpage SetupEclipse BasicsAssignmentsNotes from Lab

Starting a new project using Eclipse:
Note:  This process is fairly straightforward, but we will show you a couple of default options to change, which will make your life easier later on.

First, open up Eclipse.  If you have not already installed Eclipse, follow these instructions.

Once Eclipse is open:

1. Click the "new project" icon (open folder with J and +) to create a new project

2. Select "Create separate source and output folder"
and click on link "Configure default..."

3. Select "Folders" radio button; "src" and "bin" are offered as defaults.

You will want to give your project a name, then you are ready to begin programming!


To make a new class, right-click on the project, click 'New', then 'Class'

Choose a name for the class:

Then you can start entering in Java code inside the class:

As you can see, the Eclipse underlines with red squiggly lines what it does not understand (appears like an 'error').  In the above code, it is underlining the code from the 'Wheels' package that we did not import yet.  Red squiggly underlined code is what Eclipse believes to be an error- and your program will not run until you correct all of them.

At this point we need to import the 'Wheels' package.  If you do not already have it downloaded and extracted, follow the instructions here.

To import the 'Wheels' package, drag the 'wheels' folder on your desktop into the 'src' folder:

After this, the red squiggly lines should go away, and your package should look like this:

To run the program, you can right-click on the class you want to run (in this case, LastNameFirstName1.java).  Then scroll down to 'Run-As', then choose 'Java Application'.

Note:  this process will only work if your code is error-free.  Eclipse will automatically compile your code and test for errors every time you save your work.

The above code, when run, will look like this:

Remember, just because your code runs doesn't mean it's perfect.  You will need to check to see that you have fulfilled the requirements of your assignments, that the program is 'user-friendly' (when applicable), and that your program fulfills the Java Coding Standard.