Linux中安装JDK

网友投稿 1167 2022-10-09

Linux中安装JDK

Linux中安装JDK

可以先在官网查看jdk安装说明

1、64位系统  of the 64-bit JDK on Linux PlatformsThis procedure installs the Java Development Kit (JDK) for 64-bit Linux, using an archive file (.tar.gz).These instructions use the following files:jdk-8uversion-linux-x64.tar.gz and jdk-8uversion-linux-aarch64.tar.gz (version 8u271 and later) for 64-bit ARM systems. Download the required file. Before the file can be downloaded, you must accept the license agreement. The archive file can be installed by anyone (not only root users), in any location that you can write to. However, only the root user can install the JDK into the system location. Change directory to the location where you would like the JDK to be installed, then move the .tar.gz archive file to the current directory. Unpack the archive file and install the JDK. For x64 - % tar zxvf jdk-8uversion-linux-x64.tar.gz For 64-bit ARM system - % tar zxvf jdk-8uversion-linux-aarch64.tar.gz The Java Development Kit files are installed in a directory called jdk1.8.0_version in the current directory. Delete the .tar.gz file if you want to save disk space.

中文解释:

一、-Linux版本的JDK

①我已经-​

②官网-Linux版本的JDK

​​Java Downloads | Oracle​​

会要求登录Oracle账号再开始-

二、在Linux中安装JDK

2、找到-下来的jdk···.tar.gz文件,双击该文件开始上传

3、在XFTP左边所连接的Linux目录中,把上传的jdk···.tar.gz文件和Hadoop放在一个文件夹下

4、在xshell中解压jdk

①首先进入Opt目录

cd /home/bigdata/Opt

②再输入ll命令可以查看当前目录下的文件

③ 解压jdk···.tar.gz到当前文件夹中

tar -zxvf jdk-8u331-linux-x64.tar.gz

④查看解压结果

⑤在XFTP中查看解压后 jdk1.8.0_331 下的内容

5、设置环境变量

①切换为root用户登录

su root

① 打开配置文件

vim /etc/profile

按提示输入 E

②输入配置信息

首先输入 i 进入 编辑模式 后如下图所示

输入配置信息

#set java enviromentexport JAVA_HOME=/home/bigdata/Opt/jdk1.8.0_331export JRE_HOME=/home/bigdata/Opt/jdk1.8.0_331/jreexport CLASS_PATH=.:$JAVA_HOME/lib:$JRE_HOME/libexport PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

ESC键,退出编辑模式,再输入命令 :wq

③查看配置结果

可以再输入

vim /etc/profile

O

Ctrl+Z

输入 java -version 可以查看安装成功的JDK版本

java -version

------我瓶颈了,怎么是OpenJDK ,我不明白。这下又多点事来做,这个不行,要卸载,好在卸载简单。-------

卸载完OpenJDK后,

先执行source命令让之前配置过jdk环境的profile文件再次生效

source /etc/profile

然后再查看jdk安装情况就出来了正常的Oracle的JDK了

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:开发小程序难不(小程序开发好学吗)
下一篇:SpringBoot整合MyBatis
相关文章

 发表评论

暂时没有评论,来抢沙发吧~