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.


2 Answers 2


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.

  • 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. Dec 21, 2013 at 18:35
  • Maybe the problem is in Oracle Java installation: askubuntu.com/questions/56104/…
    – Leo
    Dec 21, 2013 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. Dec 21, 2013 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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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