linux给普通用户安装自己的jdk

1、切换或者直接使用“普通用户”登陆

2、上传linux版本的jdk安装文件

3、解压

tar -xzf jdk-7u79-linux-x64.tar.gz

4、配置用户环境变量

打开用户环境变量配置文件(在该用户的根目录下边,是个隐藏文件).bash_profile

打开之后的样子:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

修改之后的样子:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

JAVA_HOME=/home/bigdata/jdk1.7.0_79

CLASSPATH=.:$JAVA_HOME/bin/tools.jar

PATH=$JAVA_HOME/bin:$PATH:$HOME/bin

export JAVA_HOME CLASSPATH PATH

然后 source 一下

source .bash_profile 

完事!!

哎,脑壳越来越不好使了!!

你可能感兴趣的:(java,linux)