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 install jdk now with this reference. According to that I have to add jdk directory to PATH variable and add an alternative via update-alternatives. I've done that and everything is fine. But there is one thing that is not clear for me: when I type which java bash returns only /usr/bin/java but tells nothing about usr/bin/jvm/java-6-oracle/bin despite this folder is in the PATH variable and as I see, bash should have find java also there and mention it in the output. Can anybody explain why there's such a "shade"?

Thank you.

share|improve this question
up vote 1 down vote accepted

/usr/bin/java is actually a symlink to /etc/alternatives/java, which is itself a symlink to the actual java binary. The update-alternatives script changes where /etc/alternatives/java is linked to. By running update-alternatives, /usr/bin/java will end up symlinked to /usr/bin/jvm/java-6-oracle/bin/java.

The reason which java returns /usr/bin/java is that /usr/bin is on your PATH before /usr/bin/jvm/java-6-oracle/bin. If you run which -a java, it should show you both /usr/bin/java and /usr/bin/jvm/java-6-oracle/bin/java.

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.