"Linux" JDK installation

Source: Internet
Author: User

1, in http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html download the latest version of the rpm file, Mine is the first one in the x86 system.

Download and drag to the Linux virtual machine.

2, running RPM-IVH jdk-8u25-linux-i586.rpm installation after installation should be installed in the/USR/JAVA/JDK1.8.0_25

3, set the environment variable run vim/etc/profile at the end of the file input

Export java_home=/usr/java/jdk1.8.0_25
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $PATH: $JAVA _home/bin

4, confirm the version input java-version look at the current version, if you do not install it, you need to choose your own newly installed version as the default

5. Change the default version

5.1 Add the new JDK to the ready-to-use option first

Input sudo update-alternatives--install/usr/bin/java java /usr/java/jdk1.8.0_25/bin/java 300// Note that the underlined part is the address of the JDK we just installed.

Input sudo update-alternatives--install/usr/bin/javac javac /usr/java/jdk1.8.0_25/bin/javac 300

5.2 Changing the default version

Enter sudo update-alternatives--config java there will be some alternatives, select the version you just added to

Finally, enter the java-version to see if the success is as shown.

"Linux" JDK installation

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.