Using Eclipse in CompSci 100E
Sometimes we need to start from scratch. There's nothing to download.
We don't need any special packages or code.
For the purposes of these notes, we are going to deal with a project
named Iliad and a class
named Troy.
You need to substitute the actual names of
project, and class(es) you want to work on.
The details apply to the machines
in 229 Social Sciences, the ICC. Other Windows environments are very
similar.
Using Eclipse
- Starting Eclipse
- Double Click on Apps folder on the Desktop
- Double Click on eclipse.exe
- Making a Project
- File->New->Project
- Java->Java Project
- Click on Next
- For Project Name type Iliad
- Click on Finish
- If asked: Switch to Java Perspective? Yes
- Creating a Class
All executable programs require one or more classes. Repeat this section
as often as needed to create the classes required.
- Select (Click on) Iliad
- File->New->Class
- Name: Troy
- At least one of your classes requires the
method main. If
this is the one, click before "public void main(String[] args)" (If this
is not the one, unclick this box if already checked.)
- Click on Finish
- Editing Source Code
- Double click on the appropriate .java file at the left
e.g., Troy.java
- (Make the changes in the code)
- (Don't make too many changes before recompiling.
It will usually be easier to locate errors after limited
changes)
- Click on the diskette icon to save
(or File->Save)
- Finish
- Compiling Source Code
- Always be sure to save any changes to compile
(Unsaved files show an asterisk in the fields above the main window.)
- Executing Your Program
If any changes were made, you must Compile (see above) first.
- Right-Click on class with main
e.g., Troy.java
- Run as->Java Application