3

Since Java 6 from Oracle is not supported with Ubuntu repositories anymore, I installed it by downloading the package from java.oracle.com, 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?

1 Answers1

4

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:

JAVA_HOME=/usr/lib/jvm/java-7-oracle

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
estibordo
  • 1,294