Install JDK in Ubuntu

Source: Internet
Author: User

1. First download JDK from the official JDK website.

2. Then, download the downloaded JDK package (jdk-8u20-linux-i586.tar.gz), open the shell, go to the super administrator permission, and enter the downloaded directory (CD directory name ), then copy the downloaded package or move it to the/usr/directory (CP jdk-8u20-linux-i586.tar.gz/usr/or MV jdk-8u20-linux-i586.tar.gz/usr /).

3. decompress the file in shell with the command, sudo tar-zxvf jdk-8u20-linux-i586.tar.gz, You can decompress the file to the/usr/directory.

4. Configure the environment variable sudo gedit/etc/profile like Windows. Add the following statement at the end of the file (confirm your path ):

Export java_home =/usr/jdk1.8.0 _ 20
Export jre_home =/usr/jdk1.8.0 _ 20/JRE
Export Path = $ java_home/bin: $ java_home/JRE/bin: $ path
Export classpath = $ classpath:.: $ java_home/lib: $ java_home/JRE/lib

5. modify the system's default JDK to make it take effect immediately (confirm your path ):

Sudo Update-alternatives -- install "/usr/bin/Java" "Java" "/usr/jdk1.7.0 _ 17/bin/Java" 300
Sudo Update-alternatives -- install "/usr/bin/javac" "javac" "/usr/jdk1.7.0 _ 17/bin/javac" 300
Sudo Update-alternatives -- install "/usr/bin/javaws" "javaws" "/usr/jdk1.7.0 _ 17/bin/javaws" 300
Sudo Update-alternatives -- config Java
Sudo Update-alternatives -- config javac
Sudo Update-alternatives -- config javaws

6. Now the configuration is complete. Enter Java-version in shell. The following code indicates that the configuration is complete.

[email protected]:/usr# java -versionjava version "1.8.0_20"Java(TM) SE Runtime Environment (build 1.8.0_20-b26)Java HotSpot(TM) Server VM (build 25.20-b23, mixed mode)

 

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.