1

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?

1 Answer 1

5

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/

1
  • "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? Dec 6, 2012 at 9:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .