net2020

Installing Eclipse IDE on Linux

4/12/2014

Installing Eclipse IDE on Linux

Introduction

Eclipse is an open source user interface platform. It provides IDEs (Integrated Development Environments) for several programming languages, including Java and Scala.

This document explains how to install Eclipse IDE for Java programming language. This document assumes that you have root access to your Linux box. If not you should install Eclipse somewhere in your home directory.

If you have root access you can install Eclipse into a shared directory, and every user will have his/her own configuration stored in their respective home directory.

If you do not have root access, or do not want to share Eclipse installation, scroll down to Single user installation.

Download and setup

Eclipse website is here: www.eclipse.org

Open this link in your browser: Eclipse Packages

Find Eclipse IDE for Java Developers and select 32 or 64 bit version (default is Linux 64-bit). To find out if you have 32 or 64 bit operating system open a terminal window. On Linux desktop you can open a terminal from Applications menu (Applications/Accessories/Terminal). Press ENTER after each command.

uname -m
// i686 means you have 32 bit Linux
// x86_64 means you have 64 bit Linux

Click on the appropriate link (Linux 32 bit or Linux 64 bit), then click on Download (Save File). Download should start, save that file (e.g. eclipse-java-kepler-SR1-linux-gtk-x86_64.tar.gz) to disk (in /home<user>/Downloads directory).

If you have root access:

cd /opt
mkdir eclipse
cd eclipse
mv /home/<user>/Downloads/eclipse-java-kepler-SR1-linux-gtk-x86_64.tar.gz .
tar xvf eclipse-java-kepler-SR1-linux-gtk-x86_64.tar.gz
rm eclipse-java-kepler-SR1-linux-gtk-x86_64.tar.gz
mv eclipse kepler-sr1
ln -s kepler-sr1 default

At this point you should see /opt/eclipse/default directory (owned by root user). Having a default link will help with upgrading Eclipse to a newer version later on. Once you download a new version you can remove that link and create a new one with the same name but pointed to the new directory.

Create links to Java platform executables

Create Eclipse link in /etc/alternatives:

cd /etc/alternatives
ln -s /opt/eclipse/default/eclipse

Note Command ln usually takes two parameters (source file name and the target file name) but if target file name is the same as the source file name you can skip the second parameter.

Create Eclipse link in /usr/local/bin:

cd /usr/local/bin
ln -s /etc/alternatives/eclipse

At this point typing: which eclipse Should print: /usr/local/bin/eclipse

If that does not work check if /usr/local/bin folder is part of default path: set | grep PATH

On my system that prints: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

If you do not see /usr/local/bin edit your /etc/profile file (as root):

cd /etc
vi profile
// add this line at the end:
export PATH=/usr/local/bin:$PATH

User specific Eclipse configuration is located in home folder, for example: ~/.eclipse/org.eclipse.platform_4.3.0_1449841019_linux_gtk_x86_64

Single user installation

cd
mkdir eclipse
cd eclipse
mv /home/<user>/Downloads/eclipse-java-kepler-SR1-linux-gtk-x86_64.tar.gz .
tar xvf eclipse-java-kepler-SR1-linux-gtk-x86_64.tar.gz
rm eclipse-java-kepler-SR1-linux-gtk-x86_64.tar.gz
mv eclipse kepler-sr1
ln -s kepler-sr1 default

At this point you should see ~/eclipse/default directory (owned by your user).

Test Eclipse IDE installation

Log in as a regular user, type eclipse on command line and press enter. If you performed single user installation make sure you are in ~/eclipse/default directory. Eclipse IDE should show up and ask you to choose your workspace directory. I usually choose ~/workspace folder but you can choose any other folder you have read/write access to. Exit Eclipse.

Update Eclipse memory settings

Default memory settings for Eclipse might be a bit low so it's good to check those. If you installed Eclipse in shared folder you will need to log in as root again and go to /opt/eclipse/default folder. Otherwise go to ~/eclipse/default folder.

Open eclipse.ini in your favorite text editor and make the following changes:

-XX:MaxPermSize=1024m
-XX:PermSize=512m
-Xms1024m
-Xmx2048m
-XX:+UseParallelGC

Save changes and close text editor. Check how much memory your computer has and set these values accordingly. You can check available memory with free command.

At this point your Eclipse IDE should be up and running. See below for some additional tips on further customization.

Create Eclipse desktop launcher

Right click on empty desktop area, select Create launcher option. Left click on icon image, navigate to File System/opt/eclipse/default and select icon.xpm file.

Enter Eclipse IDE as Name (or something else). If you installed Eclipse as root enter /opt/eclipse/default/eclipse as Command. If you installed Eclipse as a regular user enter /home/{user}/eclipse/default/eclipse as Command. Click OK.

Disable imports folding in Java code editor

To disable imports folding Start Eclipse, go to Window/Preferences/Java/Editor/Folding and uncheck Enable folding box.