Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
730 views
in Technique[技术] by (71.8m points)

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

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 openjdk-7-jdk.
Initially i have jdk 7 installed in my system but ater i have removes it but still facing problem while running the application.

after running the cammand

sudo update-alternatives --config java

it shows warning as follows

update-alternatives: warning: /etc/alternatives/java is dangling, it will be updated with best choice.
There is only one alternative in link group java: /usr/lib/jvm/java-7-openjdk/jre/bin/java Nothing to configure.

what should I do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Assuming you installed the OpenJDK6 with:

sudo apt-get install openjdk-6-jdk

In Ubuntu 64 bit, make sure the paths are valid for your installation (change if using 32bit version):

/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java

/usr/lib/jvm/java-6-openjdk-amd64/bin/javac

Setup update-alternatives:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-6-openjdk-amd64/bin/javac" 1

sudo update-alternatives --set java /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-6-openjdk-amd64/bin/javac

Alternatively, make sure the correct version is checked for both Java and compiler:

sudo update-alternatives --config java
sudo update-alternatives --config javac

List the installed Java alternatives with:

sudo update-alternatives --list java
sudo update-alternatives --list javac

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...