Je souhaite désinstaller Java 7 et installer la version 6 (certains programmes que je souhaite utiliser sont incompatibles avec 7).
J'ai essayé :
$ Sudo apt-get remove openjdk-7-jre
[Sudo] password for USER:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libatk-wrapper-Java-jni : Depends: libatk-wrapper-Java (>= 0.30.4-0ubuntu4) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
$ Sudo dpkg -r openjdk-7-jre
dpkg: dependency problems prevent removal of openjdk-7-jre:AMD64:
default-jre depends on openjdk-7-jre (>= 7~u3-2.1).
icedtea-7-plugin:AMD64 depends on openjdk-7-jre.
icedtea-netx:AMD64 depends on openjdk-6-jre (>= 6b23~pre10~) | openjdk-7-jre; however:
Package openjdk-6-jre is not installed.
Package openjdk-7-jre:AMD64 is to be removed.
openjdk-7-jdk:AMD64 depends on openjdk-7-jre (= 7u15-2.3.7-0ubuntu1~12.10).
dpkg: error processing openjdk-7-jre:AMD64 (--remove):
dependency problems - not removing
Errors were encountered while processing:
openjdk-7-jre:AMD64
$ dpkg -l | grep icedtea
ii icedtea-7-jre-jamvm:AMD64 7u15-2.3.7-0ubuntu1~12.10 AMD64 Alternative JVM for OpenJDK, using JamVM
ii icedtea-7-plugin:AMD64 1.3-1ubuntu1.1 AMD64 web browser plugin based on OpenJDK and IcedTea to execute Java applets
ii icedtea-netx:AMD64 1.3-1ubuntu1.1 AMD64 NetX - implementation of the Java Network Launching Protocol (JNLP)
ii icedtea-netx-common 1.3-1ubuntu1.1 all NetX - implementation of the Java Network Launching Protocol (JNLP)
monkey@ICANSEEYOU:~$ dpkg -l | grep jre
ii default-jre 1:1.7-43ubuntu3 AMD64 Standard Java or Java compatible Runtime
ii default-jre-headless 1:1.7-43ubuntu3 AMD64 Standard Java or Java compatible Runtime (headless)
ii icedtea-7-jre-jamvm:AMD64 7u15-2.3.7-0ubuntu1~12.10 AMD64 Alternative JVM for OpenJDK, using JamVM
ri openjdk-7-jre:AMD64 7u15-2.3.7-0ubuntu1~12.10 AMD64 OpenJDK Java runtime, using Hotspot JIT
ii openjdk-7-jre-headless:AMD64 7u15-2.3.7-0ubuntu1~12.10 AMD64 OpenJDK Java runtime, using Hotspot JIT (headless)
ii openjdk-7-jre-lib 7u15-2.3.7-0ubuntu1~12.10 all OpenJDK Java runtime (architecture independent libraries)
Avant de supprimer Oracle Java, vous devez choisir une autre implémentation pour fournir Java. Faites-le avec Sudo update-alternatives --config Java
Ensuite, vous devriez pouvoir l'enlever. Ou vous pouvez le laisser comme il ne devrait pas être utilisé à ce stade.
Je suppose que vous utilisez 12.10 ou 13.04. Ici, default-jre dépend de openjdk-7-jre. Donc, vous ne pouvez pas supprimer openjdk-7 sans supprimer également default-jre et casser beaucoup d'autres dépendances.
Mais installer openjdk-6 sous openjdk-7 ne pose aucun problème.
Vous pouvez maintenant essayer de configurer l’application problématique pour utiliser le bon jdk ou modifier le jre par défaut avec la commande update-alternatives
. Voici un petit assistant pour cette tâche:
function updateDefaultJava() {
local pkgArch
case $(Arch) in
x86_64) pkgArch=AMD64;;
i686) pkgArch=i386;;
*) echo "unhandled architecture $(Arch)"; return 1;;
esac
local javaBase=/usr/lib/jvm/Java-6-openjdk-${pkgArch}
local cmd
for cmd in jre/bin/Java jre/bin/javaws
do
local c=$(basename ${cmd})
update-alternatives --set ${c} ${javaBase}/${cmd} || let retC+=$?
done
done
exit ${retC}
}
updateDefaultJava