Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 4 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

Edit:

To know the location of your JVM run -

> sudo find / -name rt.jar

The output on my system is -

/usr/lib/jvm/jdk1.6.0_37/jre/lib/rt.jar
/usr/lib/jvm/jdk1.7.0_09/jre/lib/rt.jar

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
add comment

Your Answer

 
discard

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.