Install jdk 8 in Linux and configure environment variables.

Source: Internet
Author: User

Install jdk 8 in Linux and configure environment variables.

1. Download jdk

Address: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2. decompress the downloaded file to the/usr/lib/jvm folder. If this folder does not exist, you can create a new folder.

Cp-r/home/xx/download/jdk1.8.0 _ 25/usr/lib/jvm

3. Configure Environment Variables

Run the following command:

Gedit ~ /. Add bashrc at the end:
1234 Export JAVA_HOME =/usr/lib/jvm/jdk1.8.0 _ 25 export JRE_HOME =$ {JAVA_HOME}/jreexport CLASSPATH =.: $ {JAVA_HOME}/lib :$ {JRE_HOME}/libexport PATH =$ {JAVA_HOME}/bin: $ PATH
Save and exit. Enter the following command to make the environment variable of the configuration take effect.
Source~ /. Bashrc
4. Configure the default jdk version and run the following command: sudo Update-alternatives -- Install /Usr/bin/java Java /Usr/lib/jvm/jdk1.8.0 _ 25/bin/java 300 sudo Update-alternatives -- Install /Usr/bin/javac Javac /Usr/lib/jvm/jdk1.8.0 _ 25/bin/javac 3005 open a terminal and enter the java-version command.
Output java version "1.8.0 _ 25"
Java (TM) SE Runtime Environment (build 1.8.0 _ 25-b17)
Java HotSpot (TM) Server VM (build 25.25-b02, mixed mode)
Indicates that the test is successful.

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.