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.

Possible Duplicate:
How do I make java default to a manually installed JRE/JDK?

I've got the following in /.bashrc

    export JAVA_HOME=/usr/bin/jdk1.7.0_03/ 
export PATH=$PATH:/usr/bin/jdk1.7.0_03/bin

This is fine, if I do $JAVA_HOME I get the directory above.

The problem is if I do java -version I get...

OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

How do I make the official jdk version the right one?

share|improve this question

marked as duplicate by izx, Jorge Castro, jokerdino, John S Gruber, con-f-use Aug 20 '12 at 11:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 2 down vote accepted

You'll need to get into the command line for this one (although I expect you're happy with that if you've installed the JDK!).

Open a terminal using Ctrl+Alt+t. Then type:

sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws

I see you're new to Ubuntu so I'll explain some of these commands. Sudo tells the computer to execute the following command with the super-user's privileges. You will therefore be asked for your password. Update-alternatives keeps track of what your preferred options are when you have several software packages providing similar functionality, such as different JDKs. The rest is just telling update-alternatives what you'd like to configure. Never enter commands in a terminal if you don't know roughly what they'll do. If in doubt, enter man <command name> in the terminal to read the command's manual.

share|improve this answer

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