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've been following these steps and got up to the check version of new JRE installation part but java -version doesn't return anything.

I have run sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0/bin/java.

It returned update-alternatives: using /usr/lib/jvm/jre1.7.0/bin/java to provide /usr/bin/java (java) in auto mode so it seems I did that part right.

It might have something to with environmental variables, e.g. JAVA_HOME and PATH but I'm not sure how to set them.

share|improve this question

When installing java I use the following steps and they always work without fail:

  1. Download latest tar from the Oracle website
  2. Extract the contents and move the folder into:


  3. Install Java alternatives:

    sudo update-alternatives --install /usr/bin/java java /usr/bin/jvm/<jreName>/bin/java 1

  4. Update alternatives (generally is not necessary if you are installing your first Java version but obviously does not hurt to run just to be sure):

    sudo update-alternatives --config java

  5. Provide the link to the plugin for your browser:

    ln -s /usr/lib/jvm/<jreName>/amd64/ .mozilla/plugins/

These steps have always worked for me without a single issue. If you are running into any troubles after following these (maybe step 4 could be all you need), then please post more information like:

  • What java -version actually displays (or is it literally blank?)
  • The results of sudo update-alternatives --config java

In my experience, I have never seemed to need JAVA_HOME and currently have perfectly working versions of Java with no variable set.

share|improve this answer
That's almost exactly the same as what I've been doing. Sorry for the laaaaate reply. – 5ives Dec 4 '12 at 8:35
No worries, does java -version return anything at all? Or just an incorrect output? What version of Ubuntu are you on? – B T Dec 7 '12 at 5:00

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.