Eclipse is available through Ubuntu's Universe repository, but if you want the latest and greatest then grab a copy directly from www.eclipse.org/downloads.
I going to assume you already have Java installed, as described in this post. Using the java command we can check, if we should download the 32 or 64 bit version of Eclipse.
bob@home:~$ java -version java version "1.8.0_74" Java(TM) SE Runtime Environment (build 1.8.0_74-b02) Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
In this case it's a 64 bit Java installation, so lets grab the Eclipse IDE for Java EE Developers 64 bit Linux version.
Eclipse is either installed as a private application or a multiuser application. On Linux, application binaries are often installed in a location shared by all users and data in the user's home folder, so let's go for the multiuser install. This entails installing Eclipse in /usr/local with ownership set to root. Other users get read and execute, but no write permissions. This causes Eclipse to store user data in the user's home folder under ~/.eclipse and ~/workspace.
First extract the Tar file:
bob@home:~$ umask 002
bob@home:~$ cd Downloads
bob@home:/Downloads$ tar xvzf eclipse-jee-mars-1-linux-gtk-x86_64.tar.gz
The umask command above caused write permission to be stripped from other users than owner and group for all new files extracted from the Tar.
Move Eclipse to /usr/local and set owner and group to root:
bob@home:/Downloads$ sudo mv eclipse /usr/local bob@home:/Downloads$ cd /usr/local bob@home:/usr/local$ sudo chown -R root:root eclipse/
Of course we are not actually going to run Eclipse as root. Setting root as owner and group is simply to avoid that any regular user gets special permissions to the installation folders. The permissions that matter to actual users running Eclipse, are the ones assigned to all other users than owner and group. Because we stripped write permission from all other users, no one can mess up the installation folder, but all are free to read and execute eclipse files. As mentioned earlier the lack of write access will trigger Eclipse to store user data in the user's home directory. Check that other users only have read and execute permission (it's the last r-x permission column):
bob@home:/usr/local$ ll eclipse total 636 drwxrwxr-x 8 root root 4096 Sep 24 12:40 ./ drwxr-xr-x 12 root root 4096 Feb 16 10:58 ../ -rw-rw-r-- 1 root root 275768 Sep 24 12:40 artifacts.xml drwxrwxr-x 4 root root 4096 Sep 24 12:40 configuration/ drwxrwxr-x 2 root root 4096 Sep 24 12:40 dropins/ -rwxr-xr-x 1 root root 79058 Sep 4 07:56 eclipse* -rw-rw-r-- 1 root root 448 Sep 24 12:40 eclipse.ini -rw-rw-r-- 1 root root 60 Sep 2 16:05 .eclipseproduct drwxrwxr-x 174 root root 20480 Sep 24 12:40 features/ -rwxr-xr-x 1 root root 140566 Sep 4 07:56 icon.xpm* drwxrwxr-x 4 root root 4096 Sep 24 12:40 p2/ drwxrwxr-x 19 root root 90112 Sep 24 12:40 plugins/ drwxrwxr-x 2 root root 4096 Sep 24 12:40 readme/
Eclipse Mars.2 takes issue with gtk3 on Ubuntu 16.04. If you experience 100% cpu load and menus that don't work, then create a startup script for Eclipse that disables gtk3 as follows.
Create a run script for Eclipse that disables gtk3:
bob@home:/usr/local/$ sudo vim eclipse/run-eclipse.sh
Enter insert mode by pressing i then paste this content to the file:
#!/bin/bash export SWT_GTK3=0 export UBUNTU_MENUPROXY=0 /usr/local/eclipse/eclipse
Press ESC to exit insert mode, then save and quit by typing :wq.
Make sure the script is executable by other users
bob@home:/usr/local$ sudo chmod o+rx eclipse/run-eclipse.sh
To run eclipse using the new script:
bob@home:/usr/local$ cd eclipse bob@home:/usr/local/eclipse$ ./run-eclipse.sh
Finally create a desktop file to make Ubuntu's desktop aware of Eclipse. This enables us to launch Eclipse from Ubuntu's dash or place the Eclipse application icon in the launcher bar.
bob@home:/usr/local$ cd /usr/share/applications bob@home:/usr/share/applications$ sudo nano eclipse.desktop
Add the following content to the new eclipse.desktop file:
[desktop Entry] Name=Eclipse Comment=Integrated Development Environment Exec=/usr/local/eclipse/eclipse Terminal=false Type=Application Icon=/usr/local/eclipse/icon.xpm Categories=Development;IDE;
Save the file ctl-o and close it ctl-x.
Ubuntu discovers the desktop file, when we issue this command:
bob@home:/usr/share/applications$ sudo desktop-file-install eclipse.desktop
Now when we open the dash and begin to type eclipse, we should see this:
When Eclipse is running, we can right-click the icon in the launcher bar and select lock to launcher.