update-alternatives: warning: /etc/alternatives/java is dangling

前端 未结 3 1671
悲哀的现实
悲哀的现实 2020-12-08 05:26

I am facing the problem while running the java program from command line. I have openjdk-6-jdk installed in my linux system and still shows the error relates with the openjd

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 06:13

    If you install openjdk 8 in docker. Maybe you need to install "software-properties-common"

    apt-get update && apt-get install apt-file -y && apt-file update && apt-get install software-properties-common
    

    And then you install openjdk 8 and setup update-alternatives with end number = 3

    sudo apt-get install openjdk-8-jdk
    export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
    
    update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java" 3
    update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-8-openjdk-amd64/bin/javac" 3
    

提交回复
热议问题