ubuntu安装jdk
2022/7/29 5:22:43
本文主要是介绍ubuntu安装jdk,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1. orcale官网下载jdk: https://www.oracle.com/java/technologies/downloads/#java11
jdk安装:
Compressed Archive 需自己编译
RPM Package :RPM包,redhat/suse等系统使用;
Debian Package 标准unix归档包,文件后缀deb;
deb是debian linux(ubuntu等)的安装格式;
rpm是redhat、fedora和suse的格式;
2.dpkg -i命令安装
dpkg -i jdk-11.0.16_linux-x64_bin.deb root@ecs-df00:/home/dev# dpkg -i jdk-11.0.16_linux-x64_bin.deb Selecting previously unselected package jdk-11. (Reading database ... 117282 files and directories currently installed.) Preparing to unpack jdk-11.0.16_linux-x64_bin.deb ... Unpacking jdk-11 (11.0.16-1) ... Setting up jdk-11 (11.0.16-1) ... root@ecs-df00:/home/dev# ll
查看安装结果
root@ecs-df00:/home/dev# find / -name jdk-11 /usr/lib/jvm/jdk-11 /usr/share/doc/jdk-11
3.设置环境变量:
在/etc/profile 或者 /etc/bash.bashrc(其他系统的/etc/.bashrc)中编辑添加:
#jdk export JAVA_HOME=/usr/lib/jvm/jdk-11 export JRE_HOME=${JAVA_HOME} export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${PATH}:${JAVA_HOME}/bin
wq!保存退出并运行生效:
source /etc/profile
检查是否安装成功
root@ecs-df00:/usr/lib/jvm# echo $JAVA_HOME /usr/lib/jvm/jdk-11 root@ecs-df00:/usr/lib/jvm# java -version java version "11.0.16" 2022-07-19 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.16+11-LTS-199) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.16+11-LTS-199, mixed mode)
这篇关于ubuntu安装jdk的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23Springboot应用的多环境打包入门
- 2024-11-23Springboot应用的生产发布入门教程
- 2024-11-23Python编程入门指南
- 2024-11-23Java创业入门:从零开始的编程之旅
- 2024-11-23Java创业入门:新手必读的Java编程与创业指南
- 2024-11-23Java对接阿里云智能语音服务入门详解
- 2024-11-23Java对接阿里云智能语音服务入门教程
- 2024-11-23JAVA对接阿里云智能语音服务入门教程
- 2024-11-23Java副业入门:初学者的简单教程
- 2024-11-23JAVA副业入门:初学者的实战指南