Centos7下安装与卸载Jdk1.8

Centos7下安装与卸载Jdk1.8卸载查看已经安装的jdk[root@bogonjre]#rpm-qa|grepjdkjava-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_

大家好,又见面了,我是你们的朋友全栈君。

卸载

查看已经安装的jdk

[root@bogon jre]# rpm -qa|grep jdk
java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64

卸载命令

[root@bogon jre]# yum -y remove java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64

卸载完成之后Java命令不被识别

[root@bogon lib]# java -version
bash: java: command not found...

安装

去官网下载jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
解压到安装目录

[root@bogon software]# tar -zxvf jdk-8u101-linux-x64.tar.gz -C /usr/local/java/

安装完毕之后在/etc/profile文件末尾添加

[root@bogon software]# vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_101
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

使/etc/profile生效

[root@bogon jdk1.8.0_101]# source /etc/profile

检测安装是否成功

[root@bogon jdk1.8.0_101]# java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
[root@bogon jdk1.8.0_101]# 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
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/152994.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 模拟登陆CSDN——就是这么简单「建议收藏」

    模拟登陆CSDN——就是这么简单

    2022年2月6日
    45
  • python和c++哪个好_pycharm怎么创建python项目

    python和c++哪个好_pycharm怎么创建python项目创建项目首先打开Pycharm勾选IconfirmthatIhavereadandacceptthetermsofthisUserAgreement接下来选择Don’tsend就可以了初次登陆的时候因为你没有Project,所以我们可以创建一个Project随后,我们便可以得到以下界面,new1是项目的名称,new1之前的是你项目所在路径,当然你也可以设置其他的名称,尽…

    2022年8月26日
    14
  • MyBatis标签详解

    MyBatis标签详解MyBatis标签详解

    2022年4月22日
    67
  • SpringBoot面试题大汇总附答案,SpringBoot面试题-持续更新中「建议收藏」

    SpringBoot面试题大汇总附答案,SpringBoot面试题-持续更新中「建议收藏」2021最新SpringBoot面试题【附答案解析】SpringBoot面试题及答案2021,SpringBoot2021最新面试题及答案,SpringBoot面试题新答案已经全部更新完了,有些答案是自己总结的,也有些答案是在网上搜集整理的。这些答案难免会存在一些错误,仅供大家参考。如果发现错误还望大家多多包涵,不吝赐教,谢谢~SpringBoot最新面试题大汇总,附答案其实,博主还整理了,更多大厂面试题,直接下载吧下载链接:高清172份,累计7701页大厂面试题PDF1、SpringBoo

    2022年6月7日
    48
  • being搜索引擎用户体验[通俗易懂]

    being搜索引擎用户体验[通俗易懂]being的搜索引擎带有的自动区别全英(汉)来呈现不同内容的结果,使用户能更快找到需要的结果。它的取词翻译可以很快的使用户得到想要的讯息。但是它的取词翻译有很多地方有一些多余,如myusou

    2022年7月1日
    51
  • SCSA考试大纲[通俗易懂]

    SCSA考试大纲[通俗易懂]认证考试形式和结构一、试卷满分及时间试卷满分为120分,考试时间为80分钟,80分通过二、考试形式在线考试三、答题方式闭卷四、试卷内容知识结构试题比例网络基础15%信息安全基础5%数据传输安全15%上网行为安全30%边界安全20%…

    2022年6月20日
    36

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号