Linux Install, update jdk

Source: Internet
Author: User

Download and install the JDK below Linux, the main two-step, first, download the JDK in the appropriate location. Second, configure the environment variables.

First step, download the JDK http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html download the appropriate version, Recommended download. tar.gz End of "jdk-8u51-linux-i586.tar.gz"

The second step, put in the appropriate position, is said to extract to the appropriate location. On the Linux command line, enter the Echo $JAVA _home, which will show a path, for example, my computer will now display,/usr/lib/jvm/jdk1.7.0_79 So, it is recommended to unzip to the appropriate location command: sudo tar zxvf Jdk-8u51-linux-i586.tar.gz-c/USR/LIB/JVM

The third step, configure the environment variables, in the Linux terminal, input sudo gedit/etc/profile, (with the sudo command in order to ensure that the configuration file can be changed, otherwise under the root user can.) Open the configuration file at the end of the add as follows:

Export java_home=/usr/lib/jvm/jdk1.8.0_51
Export path= $JAVA _home/bin: $PATH
Export classpath=.: $JAVA _home/lib

Then save the changes.

The fourth step, the Linux terminal input source/etc/profile This command is used to make the new configuration effective. This time again in the terminal input java-version should be able to see the version has changed.

Additional skills: If the above is not good, on the above basis, do the following:

Execute in the terminal sequentially

sudo update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.8.0_51/bin/java 300
sudo update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk1.8.0_51/bin/javac 300
sudo update-alternatives--install/usr/bin/jar Jar/usr/lib/jvm/jdk1.8.0_51/bin/jar 300

Re-execute

sudo update-alternatives--config java

This time there will be a variety of JDK version let you choose to enter its number, such as input: 3. (here 3 is the hypothesis, select the number corresponding to the/usr/bin/javac javac/usr/lib/jvm/jdk1.8.0_51.)

At this point, the terminal input java-version can see the version has been upgraded.

Thank you for reading.

Linux Install, update jdk

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.