ubuntu 22.04如何安装java环境
1、系统信息
root@ubuntu2204test01:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: 22.04 Codename: jammy
2、测试java
root@ubuntu2204test01:/home/software# java Command 'java' not found, but can be installed with: apt install openjdk-11-jre-headless # version 11.0.15+10-0ubuntu0.22.04.1, or apt install default-jre # version 2:1.11-72build2 apt install openjdk-17-jre-headless # version 17.0.3+7-0ubuntu0.22.04.1 apt install openjdk-18-jre-headless # version 18~36ea-1 apt install openjdk-8-jre-headless # version 8u312-b07-0ubuntu1
3、安装java运行环境
root@ubuntu2204test01:/home/software# apt install openjdk-11-jre-headless
4、测试jjava运行环境
root@ubuntu2204test01:~# java --version openjdk 11.0.15 2022-04-19 OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1) OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing)
5、测试javac命令
root@ubuntu2204test01:/home/software# javac
6、安装java开发环境
root@ubuntu2204test01:/home/software# apt install openjdk-11-jdk-headless
7、测试javac命令
root@ubuntu2204test01:/home/software# javac --version javac 11.0.15