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'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

1 Answer 1

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:

    /usr/lib/jvm

  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/libnpjp2.so .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

 
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.