Ubuntu Switch Java Environment, configure a separate user environment

Source: Internet
Author: User

Execute command: sudo update-alternatives--config java
There is 2 choices for the alternative Java (Providing/usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
* 0/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 Auto Mode
1/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 Manual Mode
2/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 Manual Mode

Select 1

Then the server's global variable Java is turned into

Java-version
Java Version "1.7.0_121"
OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-1ubuntu0.14.04.3)
OpenJDK 64-bit Server VM (build 24.121-b00, Mixed mode)


If you only want to replace the Java environment for individual users, follow these steps:

CD ~
Vim. Profile (Join the following Java path)
Export JAVA_HOME=/USR/LIB/JVM/JAVA-8-OPENJDK-AMD64 is mainly to see where the root directory of JAVA, and then add in user profile inside the good
Export path= $JAVA _home/bin: $PATH
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Wq Save exit

Souce. Profile

Ubuntu Switch Java Environment, configure a separate user environment

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.