Today I wanted to install Eclipse IDE on raspberry pi. As we all know Raspbian comes with a pre-installed oracle-jdk8 but when I wanted to install Eclipse with apt-get :
sudo apt-get install eclipse
And pressed yes without looking at the dependencies, I saw it was installing openjdk7-headless-jre
and stuff like this. Is this a problem related to Eclipse that it can run with Openjdk on linux?
-
This is because that is what the eclipse team listed as a requirement. They could have done an either or but apparently did not.Steve Robillard– Steve Robillard2016年07月07日 01:57:26 +00:00Commented Jul 7, 2016 at 1:57
-
1Why should they use openjdk? Oracle JDK is much better.Ehsan– Ehsan2016年07月07日 02:23:07 +00:00Commented Jul 7, 2016 at 2:23
-
Probably because of the license.Steve Robillard– Steve Robillard2016年07月07日 02:24:24 +00:00Commented Jul 7, 2016 at 2:24
-
So, there is no way to tell the eclipse that I have JRE or should I download the package from eclipse.org and use that instead?Ehsan– Ehsan2016年07月07日 02:25:21 +00:00Commented Jul 7, 2016 at 2:25
-
I believe you can switch it to use a specific JDK once installedSteve Robillard– Steve Robillard2016年07月07日 02:33:24 +00:00Commented Jul 7, 2016 at 2:33
3 Answers 3
The reason is that those who packaged Eclipse for Debian (which is the distribution Raspbian is based on) decided that it needed a Java version which in the package system maps to OpenJDK 7 so it is installed.
Having several versions of Java installed is seldom a problem. You can change the actual Java version used by the standard java
command back to Oracle Java by running
sudo update-alternatives --config java
See e.g. http://www.savagehomeautomation.com/projects/raspberry-pi-change-default-java-virtual-machine-jvm.html for an example.
I'm not sure Oracle JDK is properly packaged in Raspbian (it may not be possible to do so legally). Run apt-file search $(which java)
to see what JRE/JDK package you have installed. If no package is listed, apt
simply doesn't know you have Java, that's why it tries to pull a suitable dependency when you ask it to install Eclipse.
As a short term solution, you cat tell apt
to ignore the dependency you don't want to install:
apt-get install eclipse openjdk7-headless-jre-
This will allow you to install Eclipse and test if it works with the JDK you have. Should that be the case, you'll need a permanent solution which may be one of the following:
- Edit the Eclipse package to remove the unwanted dependency (most probably
default-jre
and its alternatives) - Create an empty package which claims to provide that dependency (or one of the alternatives).
(1) will break when eclipse package is updated and the new version will again want to install default-jre
. Break may be an overstatement since nothing bad should happen, but you'll have that unwanted package installed. (2) may break when you'll want to install another package which needs default-jre
but doesn't cope well with Oracle.
I personally used (2) when I had a system running with a custom version of dbus
, since fixing all the packages listing dbus
as a dependency would have been an unmanageable mess.
-
1Oracle Java was announced as the default Java in Raspbian back in 2013. raspberrypi.org/blog/oracle-java-on-raspberry-piThorbjørn Ravn Andersen– Thorbjørn Ravn Andersen2017年01月18日 13:20:01 +00:00Commented Jan 18, 2017 at 13:20
-
@ThorbjørnRavnAndersen Then it looks like eclipse packaging issue.Dmitry Grigoryev– Dmitry Grigoryev2017年01月18日 13:38:34 +00:00Commented Jan 18, 2017 at 13:38
Eclipse is written in Java and uses the JRE to run. You may develop in a different jdk.