Linux中含有两个重要的文件 /etc/profile和$HOME/.bash_profile 每当系统登陆时都要读取这两个文件,用来初始化系统所用到的变量,其中/etc/profile是超级用户所用,$HOME/.bash_profile是每个用户自己独立的,我们可以修改该文件来设置一些变量。
1> 找到.bash_profile
$ cd (进入用户登陆目录)
$ls –al .bash_profile(.bash_profile为隐藏文件,因此要用ls –a命令查找)
$vi .bash_profile(用vi编辑.bash_profile)
2> 编辑文件把jdk安装的bin目录放到最下面
3> source /root/.bash_profile
http://www.myexception.cn/linux-unix/1961307.html
http://www.linuxidc.com/Linux/2011-05/35904.htm