3

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.

1 Answer 1

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.

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

You must log in to answer this question.

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