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
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