Linux installation JDK

Source: Internet
Author: User

Ubuntu version: Ubuntukylin-14.04.1-desktop-amd64

JDK version: jdk1.8.0_60

Installation directory:/usr/local/development/jdk1.8.0_60

installation process reference address:XXX

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


    • extract to the installation directory

    • Configure the Java environment

      Create a file /etc/ profile.d/development.sh to copy the following content to the file.
       export java_home=/usr/local/development/  jdk1.8.0_60   Export jre_home= $JAVA _home/jreexport classpath=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATHexport path= $JAVA _home/ Bin: $JRE _home/bin: $PATH  



    • Restart your computer using the command java-version Check that the JDK is installed successfully.
    • Tip One: Use development.sh to set environment variables

Many ways to set up the JDK environment variables on the network are to modify files such as /etc/environment,/etc/profile,~/,bash_profile .

In fact, if you open /etc/profile, in the end we can find that there is such a code:

if [-D/ETC/PROFILE.D]; Then for  i in/etc/profile.d/*.sh, do    if [-R $i];      $i    fi done  unset IFI

That is, at the end of the /etc/profile execution, it automatically executes all the readable files in the /etc/profile.d directory. This is why we put the work of the JDK environment variable in/etc/profile.d/development.sh , so we can easily migrate the system without modifying the /etc/profile content of the operating system.

    • Tip Two: Put the development.sh in the /usr/local/profile.d

      My system /usr/local mount point is a separate disk partition that is designed to facilitate system maintenance. /usr/local Directory In addition to the installation of the software, in fact, you can also put the configuration file under this directory, such as the above development.sh, so reinstall the system when you do not need to redo the file. Therefore, you can create a new directory /usr/local/profile.d, and then copy the development.sh to the new directory. As for how to put it under the /ETC/PROFILE.D , I think the symbolic link can be used.

Cd/ect/profile.dsudo ln-s/usr/local/profile.d/development.sh

Linux installation 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.