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 am new to java and I installed JDk 7 using

sudo apt-get install openjdk-7-jre

But when I do java -version I get this

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Server VM (build 20.1-b02, mixed mode)

How do I set it to 1.7 and also how do I set my compiler to 1.7 in eclipse?

share|improve this question

You may use the following command to change the default java version: sudo update-alternatives --config java

I think eclipse will use the default java version, but you may take a look at "Window -> Preferences -> Java -> Compiler"

share|improve this answer

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.