How to setup eclipse in Linux

eclipse-header
My environment is Lubuntu 14.04

nobu@nobu-HP-Notebook:~$ java -version
java version "1.7.0_91"
OpenJDK Runtime Environment (IcedTea 2.6.3) (7u91-2.6.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)
nobu@nobu-HP-Notebook:~$ readlink -f $(which java)
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
nobu@nobu-HP-Notebook:~$ 

After doing some reserch, OpenJDK is not as good as “regular” JDK for eclipse
So, I tried to download “regular” JDK 8

nobu@nobu-HP-Notebook:~$ sudo add-apt-repository ppa:webupd8team/java

After running this command, I realized that I should remove OpenJDK

nobu@nobu-HP-Notebook:~$ java -version
java version "1.7.0_91"
OpenJDK Runtime Environment (IcedTea 2.6.3) (7u91-2.6.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)
nobu@nobu-HP-Notebook:~$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      auto mode
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode
  2            /usr/lib/jvm/java-8-oracle/jre/bin/java          1         manual mode

Press enter to keep the current choice[*], or type selection number: 2   
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/java to provide /usr/bin/java (java) in manual mode

Then I remove the OpenJDK as follow:

nobu@nobu-HP-Notebook:~$ sudo apt-get purge openjdk*

Now removed:

nobu@nobu-HP-Notebook:~$ sudo update-alternatives --config java
There is 1 choice for the alternative java (providing /usr/bin/java).

  Selection    Path                                     Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-oracle/jre/bin/java   1         auto mode
* 1            /usr/lib/jvm/java-8-oracle/jre/bin/java   1         manual mode

And run following commands

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

Let’s see how it’s been installed

nobu@nobu-HP-Notebook:~$ readlink -f $(which java)
/usr/lib/jvm/java-8-oracle/jre/bin/java
nobu@nobu-HP-Notebook:~/Downloads$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

Downloading eclipse:
Eclipse has been download under Home\Downlolads foloder, and extract .gz file

Run this commands to move eclipse folder under opt directory:

$ cd ~/Downloads

1. Move to the folder where eclipse has downloaded

$ sudo tar -zxvf eclipse-jee-mars-1-linux-gtk-x86_64.tar.gz -C /opt

2. extract and copy the eclipse under opt directory
Note: -zxvf is extracting command for “.gz” archive file

$ gksudo gedit /usr/share/applications/eclipse.desktop

3. After the eclipse has been created, open this file and paste the below info:
Note: “gedit” is not for Lubuntu since Ubuntu uses GNOME, but Lubuntu is LXDE.

$ sudo leafpad /usr/share/applications/eclipse.desktop

Therefore, needs to use leafpad instead of gedit.

[Desktop Entry]
Name=Eclipse 4
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse

eclipse-workbench-launch
The eclipse launch with default work space