How to Install Eclipse Integrated Development Environment (IDE) and Java Development Kit (JDK) on Linux-Based Distros

Post Reply
User avatar
Eli
Senior Expert Member
Reactions: 183
Posts: 5214
Joined: 9 years ago
Location: Tanzania
Has thanked: 75 times
Been thanked: 88 times
Contact:

#1

This is a tested procedure for seamlessly installing Eclipse IDE and JDK for the most of the Linux-based distributions (change commands appropriately to suit your distribution).

The first step is to install Java Development Kit (JDK) (you can however download Java SE Development Kit 8 from http://www.oracle.com/technetwork/java/ ... 33151.html):

Open the Terminal and add the Launchpad PPA (Personal Package Archive) repository into your system:

Code: Select all

sudo add-apt-repository ppa:webupd8team/java
This PPA provides the most recent installers to automatically download and install Oracle Java JDK6 / JDK7 / JDK8 from oracle website.

Update your system packages

Code: Select all

sudo apt-get update
Install Oracle Java 8 (Change the number 8 respectively, to 6 or 7 in the code to install Java 6 or 7)

Code: Select all

sudo apt-get install oracle-java8-installer
While installing, you will be prompted to accept the license agreements, after doing so the installer will proceed.

Set the default Java by running:

Code: Select all

sudo apt-get install oracle-java8-set-default
Check if Java is installed

Code: Select all

java -version
You should get the following output or something close to that:

Code: Select all

java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Now Let's install Eclipse IDE (Integrated Development Environment)

Download Eclipse from Friends of Eclipse Mirror or elsewhere.

Unpack the tar.gz file by the tar command:

Code: Select all

tar -xvzf eclipse-inst-linux64 .tar.gz
Note that eclipse-inst-linux64 .tar.gz is the name of the compressed folder you downloaded, it may have a different name.

Open the unpacked folder (eclipse-installer), look for the executable file named "eclipse-inst", right click on it and then choose Run. You will see the wizard prompt, then select the item to install, the installation folder, and finally click Install button. In my case I selected the first item in the list:

"Eclipse IDE for Java Developers
The essential tools for any Java developer, including a Java IDE, a Git client, XML Editor, Mylyn, Maven and Gradle integration."

Next, accept the Eclipse Foundation Software User Agreement, and Eclipse installation will start.

If successfully installed, then click LAUNCH to launch Eclipse and to create a working directory.

Finally create a launcher shortcut by copying and pasting the following

Code: Select all

gedit .local/share/applications/eclipse.desktop
in the Terminal to create and open a launcher file, for current user, with gedit (you can use any text editor) text editor. When it opens, Select All, copy and paste the below content into it:
  1. [Desktop Entry]
  2. Version=Neon
  3. Name=Eclipse
  4. Comment=Eclipse is an IDE
  5. Exec=/home/USERNAME/java-neon/eclipse/eclipse
  6. Path=/home/USERNAME/java-neon/eclipse/
  7. Icon=/home/USERNAME/java-neon/eclipse/icon.xpm
  8. Terminal=false
  9. Type=Application
  10. Categories=Utility;Application;Development;

The file should be saved in the installation folder. Change its properties by double clicking it to make the file executable. Eclipse should start upon clicking on the file.

By default Eclipse is installed in /home/USERNAME/eclipse/java-neon/eclipse in my case. So change java-neon and USERNAME accordingly depending on your installation path.

Desktop launcher is not such important to Linux-based distribution users because they like to start almost everything from the Terminal. So in order to access eclipse from Terminal, we have to add it to the PATH variable as follows:
  • Open ~/.bashrc with your favorite text editor
  • Add export PATH="/home/USERNAME/eclipse/java-neon/eclipse/eclipse:$PATH" (remember to replace USERNAME)
  • Save and exit
  • Execute source ~/.bashrc in Terminal
  • You can now always start eclipse from Terminal by simply typing "eclipse" and hit Enter
NB: The following video may be helpful



I have tested my installation with the "HelloWorld" Java program:
Attachments
HelloWorld.png
0
TSSFL -- A Creative Journey Towards Infinite Possibilities!
Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “Linux and Unix Based Operating Systems”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests