Contents (hide)

How to use Eclipse

This is a short tutorial on how to do basic things with Eclipse in the university's computer labs.

Start Eclipse

Press "Start" -> "All Programs" -> "Eclipse".


If you are asked to choose your workspace, choose the workspace "S:workspace",
and we advise to check "Use this as the default and do not ask again" checkbox.


Press the "Workbench" button.


Create a new project

Press "File" -> "New" -> "Project…".


Select "Java Project" (should be the first option), and press "Next".


In "Project name:" you need to enter the project name (in this example we create the project "LabAssignment").
Press "Finish".


Add existing file to the project

You need to drag the file to the project.
You should have both the File-Explorer and Eclipse open, and drag the wanted file from the File-Explorer to your project in Eclipse.
As a result, you will see that a "(default package)" is created under the project, and the file is added to it
(in this example we added the file "" to our project).
To edit the file, you need to double click on it.

Note: When dragging a file into Eclipse this file is copied. This means that when you edit the file in Eclipse, the original file does not change.
If you want to copy the file you are editing in Eclipse, please take a look at the "Copying a file from Eclipse" section.


Note: In newer versions of Eclipse (not the one in the labs), you need to drag the file to the src folder (inside the project -> (default package).

Create a new Java file in the project

Press the right mouse button on the project, and choose "New" -> "Class".


You need to set the new file name next to "Name:" (in our example: "NewFileName"), and press "Finish".


As a result, the new file will be opened.

Run a file

Press the right button on the file name you wish to run,
and choose "Run As" -> "Java Application".


If the file compiles okay, you will see the result in the console area on the bottom.


Close a project

Press the right button on the project name you wish to close, and press "Close Project".


Open (existing, closed) project

Press the right button on the project name you wish to open, and press "Open Project".


Copying a file from Eclipse

In Eclipse, under the correct project, choose the file you want to copy (in our example
Click the right mouse button (on the file) and choose "Copy".


Then go to the File-Explorer to the directory where you want to save the file (in our example: S:New Folder).
Go to "Edit" -> "Paste".


The file should be copied to that directory.