解决查找不到JDK:
方法一:
apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-source
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd
export PATH=$PATH:/usr/lib/jvm/java-8-openjdk-amd/bin
javac -version
下载速度慢可以后边换国内的源 ,参见:www.jianshu.com/writer#/notebooks/18703718/notes/19637838
方法二:(推荐)
1.下载JDK(jdk1.8.0_151)
JDK(jdk1.8.0_151)下载地址:www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2.下载好的JDK(jdk1.8.0_151)存放在save_path
解压缩:
tar -zxf save_path+jdk-8u151-linux-x64.tar
删除:
rm save_path+jdk-8u151-linux-x64.tar
3.配置profile
保存原本的配置文件:
cp /etc/profile /etc/profile_temp
编辑配置文件:
sudo vim /etc/profile
在末尾加入:
export JAVA_HOME=savepath + /jdk1.8.0_151
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
4、激活配置文件:
source /etc/profile
网友评论