Como remover o openjdk-7?

2

Eu quero desinstalar o java 7 e instalar a versão 6 (como alguns dos programas que eu gostaria de usar são incompatíveis com o 7).

Eu tentei:

$ 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)
    
por Patryk 26.02.2013 / 01:03

2 respostas

2

Antes de remover o oracle java, você deve escolher outra implementação para fornecer java. Faça isso com sudo update-alternatives --config java

Então você deve poder removê-lo. Ou você pode deixar como não deve ser usado nesse ponto.

    
por Stephen Ostermiller 26.02.2013 / 01:25
1

Suponho que você esteja usando 12.10 ou 13.04. Aqui o padrão-jre depende do openjdk-7-jre. Então você não pode remover o openjdk-7 sem remover também o default-jre e quebrar muitas outras dependências.

Mas não é problema instalar o openjdk-6 abaixo do openjdk-7.

Agora você pode tentar configurar o aplicativo problemático para usar o jdk correto ou alterar o jre padrão com o comando update-alternatives . Aqui está um pequeno ajudante para esta tarefa:

 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
    
por H.-Dirk Schmitt 26.02.2013 / 01:23