Linux解压安装JDK

Linux解压安装JDK
创建一个文件took,将物理机中的jdk、tomcat压缩包放入虚拟机的took文件中
This image has an empty alt attribute; its file name is image-27.png

2、对jdk文件进行解压

This image has an empty alt attribute; its file name is image-28.png

3、查看是否解压成功This image has an empty alt attribute; its file name is image-29.png

4、进入jdk里面的bin目录

This image has an empty alt attribute; its file name is image-30.png

5、查询java环境变量,编写一段代码
在这里插入图片描述

6、进行编译

This image has an empty alt attribute; its file name is image-32.png

7、进入放置jdk的took文件,进入jdk,配置临时环境变量

This image has an empty alt attribute; its file name is image-33.png

首先查看本机是否安装了jdk,一般有默认的jdk
检查jdk版本: rpm -qa | grep java
卸载jdk
[root@localhost software]# rpm -e --nodeps tzdata-java-2016g-2.el7.noarch
[root@localhost software]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
[root@localhost software]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64
[root@localhost software]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
[root@localhost software]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
或者使用
[root@localhost jvm]# yum remove openjdk
This image has an empty alt attribute; its file name is image-38.png

首先到jdk官网下载自己需要的jdk版本,下载完成之后将需要安装的jdk放到指定的目录
创建目录命令:mkdir 目录名 如在usr下的local下创建java目录用来存放jdk安装包
[root@localhost ~]# cd /usr/local/java
[root@localhost java]# ll (查询java目录下的文件)
drwxr-xr-x. 8 root root jdk-10.0.1 (解压就的版本)
-rw-r–r–. 1 root root jdk-10.0.1_linux-x64_bin.tar.gz (jdk安装包)
This image has an empty alt attribute; its file name is image-35.png

解压命令:tar -zxvf 需要解压的安装包
如:tar -zxvf jdk-10.0.1_linux-x64_bin.tar.gz
解压完成后,配置环境变量,编辑文件命令:vim /etc/profile 在文件的最后添加一下信息
export JAVA_HOME=/usr/local/java/jdk-10.0.1
export CLASSPATH=.:JAVA_HOME/lib/dt.jar: J A V A H O M E / l i b / t o o l s . j a r e x p o r t P A T H = JAVA_HOME/lib/tools.jar export PATH= JAVAHOME/lib/tools.jarexportPATH=PATH:$JAVA_HOME/bin
This image has an empty alt attribute; its file name is image-36.png

用 [root@localhost java]# source /etc/profile 命令来保存配置信息,用java -version来查看版本信息。
This image has an empty alt attribute; its file name is image-37.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值