Using Eclipse in Computer Science
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 FirstProgram and a class
named HelloCompSciClass.
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.
In the ICC environment, make sure you are logged in with your net ID.
If you are using a machine that was left logged in, please log out first and
log in first (you don't want your programs saved in someone elses account:
you may save space, but you won't be able to get to it at a future time.)
In the ICC logging-in process a black window with white text will pop up.
Don't touch this. Don't do anything until it disappears. It is mounting
your files from OIT which will be needed by Eclipse.
Using Eclipse
- Starting Eclipse
- Double Click on Apps folder on the Desktop
- Double Click on eclipse.exe
- After it comes up click on the x in the top left of
the "welcome" screen to clear it.
- Making a Project
- File->New->Project
- Java->Java Project
- Click on Next
- For Project Name type FirstProgram
- 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) FirstProgram
- File->New->Class
- Name: HelloCompSciClass
- 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. HelloCompSciClass.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.
- Click on HelloCompSciClass.java
- Run->Run as->Java Application