Java IDEs and Editors II: Eclipse IDE

Eclipse is another popular Java IDE apart from Netbeans. Eclipse, much like Netbeans is also free and open source. One of the main reasons for popularity of Eclipse as compared to Netbeans has been that Eclipse is lightweight. Eclipse uses SWT which is somewhat faster than Swing on a modern machine. Nevertheless, Eclipse has gained some traction and has deeply entrenched itself in some organizations.

Getting and Installing Eclipse

You can download Eclipse from here. Eclipse, like Netbeans can be used to develop programs in many languages. Since we are interested in developing Java code, we select the Java IDE as shown below –

Getting Eclipse

Eclipse downloads are in the form of zip. You need to select the zip file pertaining to your architecture (32 bit/64 bit) and your operating system. Wait for the zip to download completely.

Installing Eclipse is pretty straightforward. You just need to unzip the downloaded file.

Running Eclipse is equally simple. You just need to run the binary file called eclipse inside the directory you created by unzipping the downloaded file. On Windows this file will be named as eclipse.exe and on UNIX like OS such as Linux and Mac OS it will be named as eclipse.

On running the eclipse binary you should see splash screen such as the one below –

Eclipse Splash Screen

The next screen asks you for workspace. Workspaces are a concept unique to Eclipse. We will come  back to workspaces in our future lessons. For the moment, just assume that workspace is a directory where Eclipse is going to store all your projects. If you change your workspace, you will start seeing the projects in the new workspace. Here is what the workspace selection window may look like –

eclipse workspace

Once you select your workspace you will be taken to the IDE whose first screen should look something like this –

eclipse window

Get rid of the welcome.html file. It is just a marketing gimmick.

Your real IDE window should look something like this –

eclipse project window 1

Creating and Running a New Project

Creating a new project is pretty intuitive. The screen captures below show the process

New Project in Eclipse 1

Now you will be asked to give a name to your project –

eclipseNewProject2

Now let us create a new Java class in the newly created project –

eclipse project new class

Now you can name your class file in the next screen. Don’t worry about the warnings. We will see Java Packages in greater details in our later lessons.

eclipse project 4

Now you will be taken to the code view of the file as shown below –

eclipseNewProject5

Note that here we have added only one line of code to the main method –

1System.out.println("Hello CodingRaptor.com");

We are now set to run our first project. Running a Java file containing main method is pretty easy. Press crl + F11 or use the Run menu. I would suggest that you memorize the keyboard shortcuts of the IDE you would be using. Using mouse is much more time consuming and for something that you are likely to hundreds of times each day, optimization matters.

On running the project you should see the output as shown next

running eclipse project

That is all you need to know to get started. We will be discussing debugging in all the different IDEs in a different lesson.

Leave a comment

Your email address will not be published.