Use update-alternatives to switch the default java commands in ubuntu

Source: Internet
Author: User



Use update-alternatives to switch the default java commands in ubuntu

Sky @ sky-VGN-CR23-B :~ $ Cd/usr/java/jdk1.7.0 _ 21/

Sky @ sky-VGN-CR23-B:/usr/java/jdk1.7.0 _ 21 $ cd ..

Sky @ sky-VGN-CR23-B:/usr/java $ sudo ln-s./jdk1.7.0 _ 21./jdk1.7


Sky @ sky-VGN-CR23-B:/usr/java $ sudo rm jdk-7u21-linux-i586.tar.gz.


Sky @ sky-VGN-CR23-B:/usr/java $ sudo update-alternatives -- install/usr/bin/java/usr/java/jdk1.7/bin/java 1
Update-alternatives: using/usr/java/jdk1.7/bin/java to provide/usr/bin/java (java) in automatic mode

Sky @ sky-VGN-CR23-B:/usr/java $ sudo update-alternatives -- config java
There is only one alternative in link group java (providing/usr/bin/java):/usr/java/jdk1.7/bin/java
No configuration is required.

Sky @ sky-VGN-CR23-B:/usr/java $ java-version
Java version "1.7.0 _ 21"
Java (TM) SE Runtime Environment (build 1.7.0 _ 21-b11)
Java HotSpot (TM) Server VM (build 23.21-b01, mixed mode)


Sky @ sky-VGN-CR23-B:/usr/java $ ll/usr/bin/java
Lrwxrwxrwx 1 root 22 April 27 01:23/usr/bin/java->/etc/alternatives/java *

Sky @ sky-VGN-CR23-B:/usr/java $ ll/etc/alternatives/java
Lrwxrwxrwx 1 root 25 April 27 01:23/etc/alternatives/java->/usr/java/jdk1.7/bin/java *

Sky @ sky-VGN-CR23-B:/usr/java $ ll/usr/java/jdk1.7
Lrwxrwxrwx 1 root 13 01:14/usr/java/jdk1.7->./jdk1.7.0 _ 21/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.