ubuntu系统下Java环境JDK的安装
Debian Linux下安装jdk
下载压缩包
官网下载对应的.gz包 点击下载
解压文件
创建一个目录用于存放解压后的文件,并解压缩到该目录下
1 | sudo mkdir /opt/java8 |
修改环境变量
sudo vim ~/.bashrc
进入文件,末尾追加如下内容:
1 | export JAVA_HOME=/opt/java8/jdk1.8.0_221 //这里要注意目录要换成自己解压的jdk目录 |
source ~/.bashrc
1 | ### 设置系统默认jdk |
sudo update-alternatives –install /usr/bin/java java /opt/java8/jdk1.8.0_211/bin/java 300
sudo update-alternatives –install /usr/bin/javac javac /opt/java8/jdk1.8.0_211/bin/javac 300
sudo update-alternatives –install /usr/bin/jar jar /opt/java8/jdk1.8.0_211/bin/jar 300
sudo update-alternatives –install /usr/bin/javah javah /opt/java8/jdk1.8.0_211/bin/javah 300
sudo update-alternatives –install /usr/bin/javap javap /opt/java8/jdk1.8.0_211/bin/javap 300
1 | 然后执行: |
sudo update-alternatives –config java
1 | ### 测试是否安装成功 |
java -version
1 | ### 突发情况 |
sudo apt-get update
sudo apt-get install –reinstall ubuntu-desktop
sudo apt-get install unity
sudo shutdown -r now
```
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment