Problem changing Java version using alternatives

后端 未结 6 963
遥遥无期
遥遥无期 2021-02-01 07:03

I\'m not quite sure how I got into this mess, but for some reason I\'m not able to change the current version of Java using alternatives. I can run alternatives --config java a

6条回答
  •  鱼传尺愫
    2021-02-01 07:54

    For Oracle Java 6u30, once you've installed their RPMs you can configure alternatives:

    /usr/sbin/alternatives --install "/usr/bin/java" "java" "/usr/java/default/bin/java" 2 \
    --slave /usr/bin/javac javac /usr/java/default/bin/javac \
    --slave /usr/bin/javadoc javadoc /usr/java/default/bin/javadoc \
    --slave /usr/bin/jar jar /usr/java/default/bin/jar \
    --slave /usr/bin/keytool keytool /usr/java/default/bin/keytool \
    --slave /usr/bin/orbd orbd /usr/java/default/bin/orbd \
    --slave /usr/bin/pack200 pack200 /usr/java/default/bin/pack200 \
    --slave /usr/bin/rmid rmid /usr/java/default/bin/rmid \
    --slave /usr/bin/rmiregistry rmiregistry /usr/java/default/bin/rmiregistry \
    --slave /usr/bin/servertool servertool /usr/java/default/bin/servertool \
    --slave /usr/bin/tnameserv tnameserv /usr/java/default/bin/tnameserv \
    --slave /usr/bin/unpack200 unpack200 /usr/java/default/bin/unpack200 \
    --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/java/default/man/man1/java.1.gz \
    --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/java/default/man/man1/keytool.1.gz \
    --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/java/default/man/man1/orbd.1.gz \
    --slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/java/default/man/man1/pack200.1.gz \
    --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/java/default/man/man1/rmid.1.gz \
    --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/java/default/man/man1/rmiregistry.1.gz \
    --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/java/default/man/man1/servertool.1.gz \
    --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/java/default/man/man1/tnameserv.1.gz \
    --slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/java/default/man/man1/unpack200.1.gz
    

    Then activate the configuration:

    /usr/sbin/alternatives --config java
    

    And select /usr/java/default/bin/java from the menu.

    Plus you must gzip the man pages

    gzip /usr/java/default/man/man1/*.1
    

    Also, the Oracle java RPMs might have clobbered your alternatives symlink so force it to be normal.

    ln -sf /etc/alternatives/java /usr/bin/java
    

提交回复
热议问题