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

Possible Duplicate:
How to install Java?
How to replace OpenJDK 6 with OpenJDK 7?

I've installed Java in Ubuntu and generally it seems to be ok, but now I'm trying to upgrade to OpenJDk 7 and finding problems. When I do which java I get the following...

epic@ubuntu:~/git/game-of-life$ which java
epic@ubuntu:~/git/game-of-life$ cd usr/bin/java
bash: cd: usr/bin/java: No such file or directory

When I do java -version it tells me it's

epic@ubuntu:~/git/game-of-life$ java -version
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.1)
OpenJDK Client VM (build 20.0-b11, mixed mode, sharing)

If I look in the Ubuntu Software Center, it thinks both 6 and 7 OpenJDK are installed, any ideas?

EDIT : just realised I added..

export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.3 export M2=$M2_HOME/bin export PATH=$M2:$PATH export JAVA_HOME=/usr/local/jdk1.6.25

to my .bashrc - should I keep doing it this way or would it be bad practice to link like this?


share|improve this question

marked as duplicate by fossfreedom, Bruno Pereira, Jorge Castro, Takkat, James Feb 3 '12 at 0:25

This question was marked as an exact duplicate of an existing question.

You cannot cd to the java binary, you can - however - do cd /usr/bin. Be prepared to follow quite a bit of symbolic links. – Thorbjørn Ravn Andersen Feb 1 '12 at 11:41

Hi I used this when I installed jdk 7 You have to use update-alternatives to set your default java version to use.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.