update-alternatives中抛出错误

时间:2013-01-30 10:08:16

标签: java linux

我正在尝试为32位操作系统安装jdk。遵循以下步骤,

  1. wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" http://download.oracle.com/otn-pub/java/jdk/6u38-b05/jdk-6u38-linux-i586.bin

  2. chmod u+x jdk-6u34-linux-i586.bin

  3. ./jdk-6u34-linux-i586.bin

  4. mkdir -p /usr/lib/jvm /usr/bin/java /usr/bin/javac /usr/bin/javaws

  5. mv jdk1.6.0_3. / usr / lib中/ JVM /`

  6. update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_38/bin/java" 1

  7. update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_38/bin/javac" 1

  8. update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.6.0_38/bin/javaws" 1

  9. 但是在运行cmd 6时我遇到了错误。任何帮助将不胜感激。

    update-alternatives: warning: forcing reinstallation of alternative /usr/lib/jvm/jdk1.6.0_38/bin/java because link group java is broken.
    update-alternatives: warning: not replacing /usr/bin/java with a link.
    update-alternatives: warning: forcing reinstallation of alternative /usr/lib/jvm/jdk1.6.0_38/bin/javac because link group javac is broken.
    update-alternatives: warning: not replacing /usr/bin/javac with a link.
    update-alternatives: error: alternative path /usr/lib/jvm/jre1.6.0_38/bin/javaws doesn't exist.
    

4 个答案:

答案 0 :(得分:13)

如果你需要在Ubuntu中安装java,你可以尝试使用以下命令,你将在你的synaptic包管理器中获得oracle-java-installer,点击它并安装它。

sudo add-apt-repository ppa:webupd8team/java

否则请尝试以下步骤

 $ wget http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jre-6u34-linux-i586.bin
 $ chmod u+x jre-6u34-linux-i586.bin
 $ ./jre-6u34-linux-i586.bin
 $ sudo mkdir -p /usr/lib/jvm
 $ sudo mv jre1.6.0_34 /usr/lib/jvm/
 $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0_34/bin/java" 1
 $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jre1.6.0_34/lib/i386/libnpjp2.so" 1
 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.6.0_34/bin/javaws" 1

答案 1 :(得分:3)

问题是您在/ usr / bin中创建了一个名为“java”的文件夹。从/ usr / bin中删除该文件夹并再次运行该命令。

答案 2 :(得分:2)

而不是第4步: 4. mkdir -p /usr/lib/jvm /usr/bin/java /usr/bin/javac /usr/bin/javaws

只需使用

$mkdir -p /usr/lib/jvm

并确保将文件移动到usr / lib / jvm,以供该用途

$mv -v jre1.6.0_34 /usr/lib/jvm/

以便您可以看到详细信息,并在安装后通过以下方式更改java和javaws的配置:

$update-alternatives --config java

从选项中选择 同样,

$update-alternatives --config javaws

如果你已经安装了另一个java

,这应该可行

答案 3 :(得分:0)

/ usr / bin 中删除文件夹 java ,然后重试