deepin/ubuntu配置java环境
1.去除本地的openjdk:
sudo apt-get remove openjdk*
2.下载jdk包,复制 进/usr/local/java目录,(java目录是自建的)
sudo tar -zxvf xxxx.gz(下载的jdk)
3.配置环境变量
sudo vi ~/.bashrc
光标移动到最后,增加:
export JAVA_HOME=/usr/local/java/jdk的文件夹名 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile
4.检测java是否生效
java -version
如果没有的话建立软连接
sudo ln -s /usr/local/java/jdk包名/bin/java /usr/local/bin
sudo ln -s /usr/local/java/jdk包名/bin/javac / usr/local/bin