My notes and thoughts about Linux, WordPress, PHP and many more.
Eclipse is an open source IDE that can used for PHP development. This tutorial shows how to install and update Eclipse in latest Ubuntu 16.04 | 18.04 LTS. This tutorial is tested on Ubuntu 16.04. But these concepts apply to a recent Ubuntu 18.04 LTS and beyond.
To get the speed benefits of using Eclipse, you need to update to the latest Java version. This is recommended if you are updating or installing Eclipse.
sudo dpkg -i jdk-11.0.1_linux-x64_bin.deb
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-11.0.1/bin/java 2
It’s very important to use the correct version that corresponds to your Java installer version. For example, jdk-11.0.1. If you are using jdk-11.0.2 then, it should be sudo update-alternatives –install /usr/bin/java java /usr/lib/jvm/jdk-11.0.2/bin/java 2
sudo update-alternatives --config java
This will auto-detect all Java installations in your computer including the latest version installed. You need to use the latest version and ignore the rest so make sure to type the number that corresponds to the latest version ( #2 in my case) see screenshot.
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-11.0.1/bin/jar 2 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-11.0.1/bin/javac 2 sudo update-alternatives --set jar /usr/lib/jvm/jdk-11.0.1/bin/jar
Finally check java version as follows:
java 11.0.1 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
Now Java is updated, you need to install Eclipse:
IMPORTANT: This procedure should only be used when Installing Eclipse for the first time. This procedure should not be used for updating Eclipse.
It would be useful to have Eclipse Icon under “Programming” such as below:
[Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Name=Eclipse IDE Comment=Eclipse Integrated Development Environment Icon=/home/replace_with_your_ubuntu_username/eclipse/php-oxygen/eclipse/icon.xpm Exec=/home/replace_with_your_ubuntu_username/eclipse/php-oxygen/eclipse/eclipse StartupNotify=true Categories=Development StartupWMClass=php-oxygen
It will now appear under “Programming” section in your Ubuntu menu.
To update Eclipse, the following are the procedures:
If after installing Eclipse using Installer wizard then clicking the “Launch” button. You will see this error:
JVM terminated. Exit code=1 /usr/lib/jvm/java-9-openjdk-amd64/bin/java -Dosgi.requiredJavaVersion=1.8 [email protected]/eclipse-workspace -XX:+UseG1GC -XX:+UseStringDeduplication --add-modules=ALL-SYSTEM -Dosgi.requiredJavaVersion=1.8 -Xms256m -Xmx1024m --add-modules=ALL-SYSTEM -Declipse.p2.max.threads=10 -Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest -Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
This is usually caused by wrong Eclipse update procedure. The solution is to simply go to /home/eclipse/ directory. Find the latest directory that is created there. This is usually the Eclipse folder that you have just installed that is providing an error.
Delete the just newly installed Eclipse directory (inside the red box in the screenshot below) and leave your old Eclipse installation intact:
Once deleted, you can follow the Eclipse update procedure above.