centos7保姆级安装jdk8教程

文章目录

    • 1、下载jdk安装包
    • 2、在centos7 创建文件夹
    • 3、解压jdk文件
    • 4、配置环境变量
      • a、打开环境变量文件
      • b、将配置信息复制进去。
      • c、重新加载环境变量
    • 5、测试是否成功

1、下载jdk安装包

jdk下载地址:https://www.oracle.com/java/technologies/downloads/
在这里插入图片描述

Oracle 登录账号:2028056560@qq.com
Oracle 登录密码:Oracle1234
若是不行,可以尝试在Oracle登录密码和账号中找一个,链接:https://bugmenot.com/view/oracle.com

2、在centos7 创建文件夹

此文件夹随便起名,我这里创建一个app文件夹,并将下载好的jdk安装文件放到此文件夹下

cd /
mkdir /app/java

3、解压jdk文件

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

4、配置环境变量

a、打开环境变量文件

vim /etc/profile

b、将配置信息复制进去。

注意:JAVA_HOME=/app/java/jdk1.8.0_401,/app/java/jdk1.8.0_401替换成你实际上安装地址

export JAVA_HOME=/app/java/jdk1.8.0_401export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$PATH:$JAVA_HOME/bin

c、重新加载环境变量

source /etc/profile

5、测试是否成功

java -version

输出

[root@test ~]# java -version
java version "1.8.0_401"
Java(TM) SE Runtime Environment (build 1.8.0_401-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.401-b10, mixed mode)
[root@test ~]# javac
Usage: javac <options> <source files>
where possible options include:-g                         Generate all debugging info-g:none                    Generate no debugging info-g:{lines,vars,source}     Generate only some debugging info-nowarn                    Generate no warnings-verbose                   Output messages about what the compiler is doing-deprecation               Output source locations where deprecated APIs are used-classpath <path>          Specify where to find user class files and annotation processors-cp <path>                 Specify where to find user class files and annotation processors-sourcepath <path>         Specify where to find input source files-bootclasspath <path>      Override location of bootstrap class files-extdirs <dirs>            Override location of installed extensions-endorseddirs <dirs>       Override location of endorsed standards path-proc:{none,only}          Control whether annotation processing and/or compilation is done.-processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process-processorpath <path>      Specify where to find annotation processors-parameters                Generate metadata for reflection on method parameters-d <directory>             Specify where to place generated class files-s <directory>             Specify where to place generated source files-h <directory>             Specify where to place generated native header files-implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files-encoding <encoding>       Specify character encoding used by source files-source <release>          Provide source compatibility with specified release-target <release>          Generate class files for specific VM version-profile <profile>         Check that API used is available in the specified profile-version                   Version information-help                      Print a synopsis of standard options-Akey[=value]              Options to pass to annotation processors-X                         Print a synopsis of nonstandard options-J<flag>                   Pass <flag> directly to the runtime system-Werror                    Terminate compilation if warnings occur@<filename>                Read options and filenames from file[root@test ~]# java
Usage: java [-options] class [args...](to execute a class)or  java [-options] -jar jarfile [args...](to execute a jar file)
where options include:-d32	  use a 32-bit data model if available-d64	  use a 64-bit data model if available-server	  to select the "server" VMThe default VM is server,because you are running on a server-class machine.-cp <class search path of directories and zip/jar files>-classpath <class search path of directories and zip/jar files>A : separated list of directories, JAR archives,and ZIP archives to search for class files.-D<name>=<value>set a system property-verbose:[class|gc|jni]enable verbose output-version      print product version and exit-version:<value>Warning: this feature is deprecated and will be removedin a future release.require the specified version to run-showversion  print product version and continue-jre-restrict-search | -no-jre-restrict-searchWarning: this feature is deprecated and will be removedin a future release.include/exclude user private JREs in the version search-? -help      print this help message-X            print help on non-standard options-ea[:<packagename>...|:<classname>]-enableassertions[:<packagename>...|:<classname>]enable assertions with specified granularity-da[:<packagename>...|:<classname>]-disableassertions[:<packagename>...|:<classname>]disable assertions with specified granularity-esa | -enablesystemassertionsenable system assertions-dsa | -disablesystemassertionsdisable system assertions-agentlib:<libname>[=<options>]load native agent library <libname>, e.g. -agentlib:hprofsee also, -agentlib:jdwp=help and -agentlib:hprof=help-agentpath:<pathname>[=<options>]load native agent library by full pathname-javaagent:<jarpath>[=<options>]load Java programming language agent, see java.lang.instrument-splash:<imagepath>show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/517563.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

基于springboot的精准扶贫管理系统论文

精准扶贫管理系统 摘要 随着信息技术在管理上越来越深入而广泛的应用&#xff0c;管理信息系统的实施在技术上已逐步成熟。本文介绍了精准扶贫管理系统的开发全过程。通过分析精准扶贫管理系统管理的不足&#xff0c;创建了一个计算机管理精准扶贫管理系统的方案。文章介绍了精…

AIGC工具( 7个 )

人工智能技术有好的一方面&#xff0c;又不好的地方&#xff0c;要区别对待&#xff0c;吸取精华&#xff0c;去其糟粕。目前市场上有很多AI大模型&#xff0c;可以支持聊天&#xff0c;写文稿&#xff0c;创作等&#xff0c;部分可以生成图片&#xff0c;以下是7个很不错的免费…

[数据结构初阶】栈

各位读者老爷好&#xff0c;鼠鼠我好久没写博客了&#xff08;太摆烂了&#xff09;&#xff0c;今天就基于C语言浅介绍一下数据结构里面的栈&#xff0c;希望对你有所帮助吧。 目录 1.栈的概念及结构 2.栈的实现 2.1定义栈 2.2.初始化栈 2.3.入栈 2.4.出栈 2.5.获取栈…

RabbitMQ队列

RabbitMQ队列 1、死信的概念 ​ 先从概念解释上搞清楚这个定义&#xff0c;死信&#xff0c;顾名思义就是无法被消费的消息&#xff0c;字面意思可以这样理解&#xff0c;一般来说,producer将消息投递到broker或者直接到queue里了&#xff0c;consumer 从 queue取出消息进行消…

微服务基础

目录 一、单体架构 二、分布式架构 三、微服务 四、微服务结构 五、SpringCloud 六、服务拆分 七、远程调用 一、单体架构 单体架构就是将业务的所有功能都集中在一个项目中进行开发&#xff0c;并打成一个包进行部署。 他的优点很明显&#xff0c;就是架构简单&#xff…

JVM-类加载机制

名词解释 *.class文件的结构 查看指令&#xff1a; javap -verbose hello.class 包含信息&#xff1a; 结构信息&#xff08;版本号&#xff0c;大小信息&#xff09;&#xff1b; 元数据&#xff08;类&#xff0c;继承&#xff0c;接口&#xff0c;字段声明&#xff0c;方法声…

应用监控 eBPF 版:实现 Golang 微服务的无侵入应用监控

作者&#xff1a;古琦 在现代软件架构中&#xff0c;微服务已成为构建可扩展和灵活应用程序的流行方式。每个微服务负责应用程序的一部分功能&#xff0c;它们共同工作以提供完整的服务。由于微服务架构的分散特性&#xff0c;监控变得至关重要&#xff0c;有效的微服务监控是…

视频推拉流EasyDSS平台直播通道重连无法转推的原因排查与解决

视频推拉流EasyDSS视频直播点播平台&#xff0c;集视频直播、点播、转码、管理、录像、检索、时移回看等功能于一体&#xff0c;可提供音视频采集、视频推拉流、播放H.265编码视频、存储、分发等视频能力服务。 用户使用EasyDSS平台对直播通道进行转推&#xff0c;发现只要关闭…

Object.keys()的用法

1、语法 Object.keys(obj) 参数&#xff1a;要返回其枚举自身属性的对象 返回值&#xff1a;一个表示给定对象的所有可枚举属性的字符串数组 2、处理对象&#xff0c;返回可枚举的属性数组 let person {name:“张三”,age:25,address:“深圳”,getName:function(){}} Obj…

Wireshark——获取指定协议的数据包

1、问题 使用Wireshark捕获了大量的数据包&#xff0c;但是只想要指定协议的数据包。 2、方法 例如&#xff0c;只想要Modbus/TCP协议的数据包。 在应用显示过滤器中输入协议的名称&#xff08;小写&#xff09;&#xff0c;回车。 选择文件&#xff0c;导出特定分组。 将所…

基于redis实现用户登陆

因为session有数据共享问题&#xff0c;不同tomcat服务器中的session不能共享&#xff0c;之后负载均衡就无法实现。所以我们用redis代替session。redis可以被多个tomcat服务器共享&#xff0c;redis基于内存。 之前的session可以看做登陆凭证&#xff0c;本次登陆凭证由sessi…

算法 - 【受限条件下可到达节点的数目】

受限条件下可到达节点的数目 题目示例1示例2 分析代码 题目 现有一棵由 n 个节点组成的无向树&#xff0c;节点编号从 0 到 n - 1 &#xff0c;共有 n - 1 条边。给你一个二维整数数组 edges &#xff0c;长度为 n - 1 &#xff0c;其中 edges[i] [ai, bi] 表示树中节点 ai 和…