1

I removed openjdk-7 completely using apt-get purge and installed oracle jdk(8u45).I have the oracle jdk in path and it is working well .The Problem is that, if I try to install any software(from cmdline or software center) which depends on java([open]jdk) ,I am forced to install openjdk. Is there any work around for this...?
Os : Ubuntu 15.10

I appended this in /etc/profile :

JAVA_HOME=/usr/local/java/jdk1.8.0_45
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME 
export JRE_HOME
export PATH
  • You can try to hold it with sudo apt-mark hold openjdk-7-jre... – wb9688 Jan 10 '16 at 13:10
  • If I want to install package XXX(which depends on java) , can I do something like this sudo apt-get install XXX && sudo apt-mark hold openjdk-7-jre – Aadhil RF Jan 10 '16 at 16:12
  • No, you must first do that apt-mark command, but I don't know 100% if it works... – wb9688 Jan 10 '16 at 16:14
0

You can choose the default version of Java to be used by Ubuntu using this:

$ sudo update-alternatives --config java

It will give you a choice if there are multiple versions installed or will set up properly if it finds just one version.

  • Thanks....but, i have already done this....didnot work – Aadhil RF Jan 10 '16 at 11:37
0

I am answering from the RPM perspective, but I'm sure DEB has something similar in place.

Every package has Provides and Requires, they do not have to match the name of the package. So for example OpenJDK provides java and java-devel. And every package that Requires it will grab it as well.

The problem is that there is no other providers for java and java-devel, Oracle JDK cannot be redistributed by license, rarely anyone cares packaging IBM or Azul JDK, other JVM implementations are not feature-full enough.

So the only workaround for your issue is: 1. establish the alternatives as suggested by aramboi. 2. create a synthetic package that will not have anything inside but will Provide java and/or java-devel.

That will be the trick to make dpkg think you have everything needed in place and it will not download openjdk any more. About 8 years ago that could cause the problems with software linked to libjvm.so, but I doubt there's anything left that still links to libjvm.so instead of just running the java executables.

0

I think better approach is to use additional repository ppa:webupd8team/java for installing Oracle JDK 7,8,9.

Details you can read here: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html.

  • Even if i use PPA , openjdk-7-jre in dependancies list of softwares will not be satisfied.. – Aadhil RF Jan 11 '16 at 1:01
  • As I see when I have installed java using ppa:webupd8team/java it will not install openjdk-7-jre in case if package depends on java, for example I removed package maven and this package depends on openjdk-7-jre, openjdk-8-jre, but after installing package maven again additional package openjdk-7-jre was not installed, I also verified and I didn't have it installed previously. So usage of repository ppa:webupd8team/java should solve your problem. – Ivan M. Jan 11 '16 at 20:04

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.