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. Commented Jul 7, 2016 at 1:57
  • 1
    Why should they use openjdk? Oracle JDK is much better.
    – Ehsan
    Commented Jul 7, 2016 at 2:23
  • Probably because of the license. Commented 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
    Commented Jul 7, 2016 at 2:25
  • I believe you can switch it to use a specific JDK once installed Commented 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:

  1. Edit the Eclipse package to remove the unwanted dependency (most probably default-jre and its alternatives)
  2. 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.


Eclipse is written in Java and uses the JRE to run. You may develop in a different jdk.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.