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

Okay here is my issue. Every time I install a .deb installer of a program that requires java. OpenJDK hijacks my system and sets it as default Java. I don't want to use OpenJDK, if I did I wouldn't be asking this question

Whenever I install a .deb package however, it installs OpenJDK and sets it as the default JDK. Which means when I have to use programs that don't work very well with OpenJDK I have to

sudo apt-get purge openjdk*

Then run the Oracle JDK .deb package to reinstall it. I don't want to have to do this, or switch from OpenJDK to Oracle's official JDK. It is time wasting. Is there anyway to stop OpenJDK from hijacking my system and setting itself to the default JDK?

Note: I call it hijacking, because it is replacing the JDK I installed with a .deb created with alien from the official jdk rpm. I don't want to use it, it doesn't ask me if it can be installed and be used as the default JDK/JRE.

share|improve this question
up vote 0 down vote accepted

Maybe setting the Oracle Java JRE/JDK as default will solve your problem: How to set default Java version? or Setting JDK 7 as default

Simply put in command line:

sudo update-alternatives --config java

And select the version you want to be default.

share|improve this answer
I don't want multiple JDK's though. I want to stop OpenJDK from even being considered as an acceptable JDK to be used. I purge my system of any extra JDK's when they are installed. sudo update-alternatives --config java doesn't work when there is no other java jdk on the system. – enkilleridos Dec 21 '13 at 18:35
Maybe the problem is in Oracle Java installation:… – Leo Dec 21 '13 at 18:41
Thank you that cleared up some things. I don't really care if I get what I want just as long as I am able to control what is being used by default and what is used only on the programs that require it. – enkilleridos Dec 21 '13 at 19:43

I think your question is duplicate with this one as you want to control default jre : How to set default Java version?

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.