top of page

How to


Eclipse IDE is a leading open-source Integrated Development Environment designed for Java development. It offers a customizable platform for developers to create, test, and deploy applications efficiently across various domains.

Installing Eclipse

To install Eclipse, please adhere to the guidelines provided in the official lecture documentation


Getting Started in Eclipse

Once you open Eclipse you will see many symbols. The ones relevant for us are the following

  1. Debugging: Debugging is useful as one can set breakpoints an interrupt the execution at this point to check what values certain variables have or what the state of objects is.

  2. Run: This button is used when you want to run code you have written. For this to work your class requires a main method or needs to be a special class like JUnit test files.

  3. Package Explorer: The package explorer lists all your projects and also shows you what classes and files are within a project folder. This is where you find all your files.


Create Projects / Files

Using the "File" Menu you can create all kinds of files and folders. The ones important to us are the following

  1. Java Project: Using this option you can create a new Eclipse Java Project Folder which will come with a source folder for you to add your classes into.

  2. Class: Creating a new class inside allows you to specify which project you would like to add this class into and its name.

  3. Source Folder: Every project comes with its source folder called "src", but you might want to add a secondary source folder, for example for test files, which you would then name "tests".

  4. Untitled Text File: You use this option to write down written exercises. Choose the ending .txt such that it will be recognized as a textfile.


Creating a new Project

When creating a new project you will be asked to specify a project name. Input your desired project name and click "Finish". You will now be asked if you want to create a module. Click "Don't create" as we will not be using modules.

After that a new Project will appear in the Package Explorer and when you right click on the source folder "src" you can then add a new class or a new interface to this source folder. When you create a class tick the box that asks you if you want a main method to be automatically generated.


Importing an existing Project

If you want to import an existing project - for example from old bonus tasks - you can do this by following these steps: 

  1. "File" Menu > "Import"

  2. A window will pop up and there you need to choose "General" > "Existing Projects into Workspace". Then click on "Next". Again a window will pop up.

  3. If you want to import a directory (normal folder), choose this option.

  4. If you want to import an archive file (zip etc.), choose this option.

  5. Select the projects you want to import and click "Finish".


Basic Java Program

After creating a class add the following code into your main method (the one you can see inside the main method to the left). Save the program using the save symbol in top left or using Ctrl + S. 

After saving the program click the run symbol and the console should open. After being asked to enter input, enter your name. You should see your name being printed together with a greeting. If this happens then you have successfully installed Eclipse and ran your first Java code. 

Screenshot 2023-09-04 at 11.50.15.png

Search Field and
Dark Mode

In the top left you will find a search field which you can use to search for anything that you might not be able to immediately find. This is very helpful as most tutorials online (including this one) discuss everything in regards to one operating system.

To enable dark mode go to Preferences (search for it in the search field if it does not show up for you) then go to Appearance and change the theme do "Dark". Dark Mode is preferred by many as it will be a bit more pleasant to look at than a white screen. It also saves battery power.


Eclipse IDE is packed with features and shortcuts that can enhance productivity. Here are some tricks and tips for Eclipse users. Try them out and look which one you could use.

  1. Code Formatting: Maintain a consistent code style by formatting your code with "Ctrl + Shift + F".

  2. Open Declaration: Hover over a method or class and press "F3" to jump to its declaration.

  3. Quick Fix: If you see an error or warning, hover over it and press "Ctrl + 1" to see suggested fixes.

  4. Toggle Comment: Quickly comment/uncomment lines of code with "Ctrl + /".

  5. Block Comment: To comment out a block of code, select the lines and use "Ctrl + Shift + /".

  6. Move Lines: To move a line or block of code up or down, use "Alt + Up/Down Arrow".

  7. Quick Search: For a quick search, press "Ctrl + Shift + L" twice. This brings up a list of all the shortcuts available in Eclipse.

  8. Code Templates: Use "Ctrl + Space" after typing a few characters to utilize code templates for common code snippets.

  9. Auto-organize Imports: Remove unused imports and organize them with "Ctrl + Shift + O".

  10. Run and Debug: Use "Ctrl + F11" to run the last launched application and "F11" to debug.

  11. Renaming: For renaming variables, methods, classes, etc., and reflecting the change everywhere, use "Alt + Shift + R".

  12. Content Assist: If you forget the name of a method or a variable, press "Ctrl + Space" to bring up suggestions.

Remember, mastering these tricks requires practice. The more you use them, the more they'll become second nature, helping you navigate and code faster in Eclipse.

A good YouTube Video covering Eclipse Shortcuts is:

"30+ Eclipse Shortcuts Every Java Programmer Should Know" by Coding with John

bottom of page