Downloading and
installing Eclipse
Step 1) Go to the following URL: http://www.eclipse.org/downloads/
Step 2) Click the “Eclipse SDK
3.2.2” link.
Step 3) Choose a mirror to
download from.
Step 4) Use the installer to
install the program. In Windows, follow
the instructions given to you by the installer.
In Mac, unzip the file (if you can’t, then download Stuffit Expander
from http://www.stuffitsoftware.com/stuffit-mac.html#expander). Once the file is
unzipped, drag the “Eclipse” folder into your “Applications” folder.
Making a new project in Eclipse
Step 1) In Eclipse, click on the
"File" menu and select the "New" option. In the new set of options, select the
"Project" option.
Step 2) Select the "Java
Project" wizard from the box and click the "Next" button.
Step 3) Name the project according
to the following convention: "section_lastname_assignment". For example, if Alex Loddengaard were making
a project for his second assignment, he would name his project,
"LA_loddengaard_2". Alex is in
section LA, his last name is Loddengaard, and he’s working on assignment 2.
Step 4) Make sure the following
options are selected:
-"Create new project in
workspace" is selected instead of "Create project from existing
source"
-"Use default JRE ..."
is selected instead of "Use a project ..."
-"Use project folder as root
..." is selected instead of "Create separate source ..."
Step 5) Click the
"Finish" button.
Adding classes to your project
Step 1) In Eclipse, right click on the project that you wish
to add a class to and selected the “New” option from the menu. Once the “New” option is selected, select the
“Class” option from the new list of options that show up.
Step 2) Name your class by entering the desired name into
the “Name:” text box. Don’t change any
other options on this screen. A warning
will show up explaining that you shouldn’t put classes in the default packages;
ignore this warning message.
Step 3) Click the “Finish” button.
Removing a class from
your project
Step 1) In Eclipse, right click on the class that you wish
to remove from your project and select the “Delete” option.
Renaming a class in
your project
Step 1) In Eclipse, right click on the class that you wish
to rename and select the “Refactor” option.
Once the “Refactor” option is selected, select the “Rename” option from
the new list of options that shows up.
Step 2) Enter the new name of the class and click the
“Finish” button. Leave all the other
options alone.
Importing classes
into your project
The easiest way to import classes into your project is to
simply drag and drop them from your file browser (Finder in Mac and Explorer in
Windows). You can also follow the below
steps:
Step 1) Right click on the project that you wish to import
classes into.
Step 2) Expand the “General” option by clicking the gray
arrow pointing to the “General” folder icon.
Select the “File System” option from this new list of options and click
the “Next” button.
Step 3) Click the “Browse” button next to the “From
directory” text box. Select the
directory that contains the classes that you wish to import and click the “OK”
button.
Step 4) In the left pane, again
select the directory that you wish to import classes from. Once you select this directory, you will be
able to choose which individual classes you want to import in the right pane. Select the .java files you wish to import and
click the “Finish” button.
Running your project
The first time you run a project in Eclipse you’ll have to
follow the below steps:
Step 1) Right click on the project you wish to run and
select the “Run As” option. When a new
set of options shows up, select the “Run” option.
Step 2) A new window will pop up
with run options. In the left pane,
double click on the “Java Application” option.
This should create a sub option under the “Java Application” option called
“New_configuration.” There is no need to
change its name, but you can if you’d like.
In the right pane, Make sure that your project shows up in the
“Project:” text box and put the name of the class that contains public static void main(String[]
args) {…} in the “Main class:” text box.
Step 3) Click the “Run” button.
The console window in the bottom pane of eclipse should
activate and your program should run.
Once you have setup this new type of run environment, you can simply
click the green play button in Eclipse’s tool panel to run your project.