Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed openjdk-6-jre from the package manager, then I installed Eclipse, and this was the default JRE.

Now I needed to install, in addition to 6, also Java 7, so I installed openjdk-7-jre from the package manager. However, in Eclipse I still see only JRE 6. Also from the command line I see only java 6:

$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

How can I use JRE 7 from Eclipse?

share|improve this question
up vote 5 down vote accepted

To make your new Java 7 installation the default one run this on shell -

> sudo update-alternatives --config java

To simply use Java 7 in your project without making it the system default go to Configure Built Path > Libraries > Add Library > JRE System Library > Installed JREs > Add > Standard VM > Directory and select the location where you installed the JVM.

Also change the Properties > Java Compiler > Compliance Level to 1.7


To know the location of your JVM run -

> sudo find / -name rt.jar

The output on my system is -


This tells me that jdk is in /usr/lib/jvm/

share|improve this answer
"select the location where you installed the JVM" I installed the JVM using the package manager. How do I know where the package manager has put it? – Erel Segal-Halevi Dec 6 '12 at 9:34
Thanks! works for me. – Erel Segal-Halevi Dec 6 '12 at 10:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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