Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

Since Java 6 from Oracle is not supported with Ubuntu repositories anymore, I installed it by downloading the package from, unpacking it in /opt and adding symlinks in /usr/bin.

Now I need to install tomcat6 and I would really like to use the repository for it (for the benefits of updates, default configuration and dir breakdown tailored for Ubuntu etc.). Unfortunately, I don't see a way to do it without installing openjdk.

How can I install tomcat6 from repository in this configuration, or tell Ubuntu that I already have Java and I'm happy with it thank you very much? Do I have to install tomcat (and all other Java-dependent packages) by downloading them from their respective websites, unpacking and adding links myself?

share|improve this question
up vote 4 down vote accepted

Since tomcat6 depends on openjdk-6-jre, when you install tomcat6, you will also install openjdk. Afterwards, you can choose to either remove or keep it, but to make sure that tomcat6 uses Oracle JAVA, you just need to:

sudo vi /etc/default/tomcat6

and set JAVA_HOME:


If you want to keep both Oracle an OpenJDK, you can check How do I install Oracle Java JDK 7? to create the /usr/lib/jvm/.java-7-oracle.jinfo file required by update-java-alternatives. Then, switch between them with:

sudo update-java-alternatives -s java-6-openjdk
sudo update-java-alternatives -s java-7-oracle
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.