一、前期准备

a) 首先从官网上下载Jdk 8 for Linux x64到window下。

b) 我这边用的最小安装,所以没有安装centos自带的openjdk,如果你安装时,不是最小安装的话,可能集成了系统的openjdk,所以我们先要删除自带的openjdk,具体步骤如下:

1) 在系统终端输入:rpm -qa | grep java,如果有openjdk的话,会出现类似于XXXX_openjdk_XXX的信息。(可能有多条)

2) 删除openjdk,在终端输入:rpm -e –-nodeps XXXX_openjdk_XXX 。即可删除自带的openjdk。(如果有多条openjdk,依次执行命令删除)

rpm -e --nodeps `rpm -qa | grep java`
二、Jdk的安装

a) 我们登录超级用户,在超级用户目录usr下建立一个目录jdk:(路径可以自己选择)

su root 之后会提示输入密码。

mkdir jdk

b) 我们进入jdk,:

c) 解压jdk压缩包

tar –xzvf jdk-8u45-linux-x64.gz

d) 解压后的jdk的文件夹名字为jdk1.8.0_45,我们把它改为jdk1.8:

mv jdk1.8.0_45/ jdk1.8/

e) 进入jdk1.8文件夹,输入pwd 获取目录jdk1.8绝对路径

cd jdk1.8

pwd

三、jdk的配置

a) 使用vim命令打开系统的环境变量配置文件:

vi /etc/profile

b) 在profile文件最后加入:

## JAVA

export JAVA_HOME=jdk的绝对路径(我的是:/root/app/jdk1.8)

export PATH=$PATH:$JAVA_HOME/bin

c) 使profile生效

source /etc/profile

四、配置验证

a) 首先,我们输入java –version,会得到:

java version "1.8.0_45"

Java(TM) SE Runtime Environment (build 1.8.0_45-b14)

Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

b) 我们再输入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

-Werror Terminate compilation if warnings occur

@<filename> Read options and filenames from file

c) 如果得到以上两步正确结果的话,恭喜你,你的jdk8就已经配置好了。

CentOS7安装Jdk1.8的更多相关文章

  1. Centos7安装JDK1.8 Linux64bit

    流程一览: 1.下载JDK1.8(jdk-8u11-linux-x64.tar.gz) 2. 解压缩安装 3.配置JAVA_HOME环境变量 4.切换JDK1.8为当前使用的JDK 5.重启,查看安装 ...

  2. centos7 安装 jdk1.8

    首先是Linux的不同版本的额系统自带的配置是不一样的,比如centos6上有的自带的jdk环境的话要装1.8的就要进行卸载或者马上进行更改 jdk是java程序依赖的环境 首先查看你的系统下是否有j ...

  3. CentOS7安装JDK1.8图文教程

    https://blog.csdn.net/weixin_42266606/article/details/80863781 1.下载 jdk 的 tar 包 网址:http://www.oracle ...

  4. centos7 安装jdk1.8

    安装之前下熟悉以下连个文件 (1)/etc/profile  全局(公有)配置,不管是哪个用户,登录时都会读取该文件.   (2)~/.bashrc: 该文件包含专用于你的bash shell的bas ...

  5. centos7安装jdk1.7(rpm版)

    一.环境 centos7 jdk-7u80-linux-x64.rpm下载:链接:https://pan.baidu.com/s/10UMrxNE1d2ZbDt7kvBM1yQ   提取码:pmov  ...

  6. Centos7安装jdk1.8并查找jdk安装目录

    安装之前先检查一下系统有没有自带open-jdk rpm -qa |grep java rpm -qa |grep jdk rpm -qa |grep gcj 如果没有输入信息表示没有安装. 如果安装 ...

  7. centos7 安装Jdk1.8.0

    不是很懂网上的文章...配置... 执行命令: rpm -qa|grep jdk 若无信息表明本机没装jdk. 执行安装命令: yum install -y java-1.8.0-openjdk-de ...

  8. CentOS7安装Elasticsearch5.5.3

    一.准备 安装Java环境,elasticsearch推荐安装java1.8.0_131或更高的版本,安装教程CentOS7安装JDK1.8 二.安装 CentOS下可以选择.tar.gz或rpm方式 ...

  9. centos7安装配置jdk、tomcat

    centos7安装jdk1.8 1.新建文件夹java,上传文件jdk-8u111-linux-x64.tar.gz到java文件夹 2.解压tar包: tar -zxvf jdk-8u111-lin ...

随机推荐

  1. Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embe

    Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationEx ...

  2. Lucene.net(4.8.0) 学习问题记录六:Lucene 的索引系统和搜索过程分析

    前言:目前自己在做使用Lucene.net和PanGu分词实现全文检索的工作,不过自己是把别人做好的项目进行迁移.因为项目整体要迁移到ASP.NET Core 2.0版本,而Lucene使用的版本是3 ...

  3. java8 集合对象间的处理

    eg1:List<CarVo> carVoList = carService.getList(carVo); List<String> listVins = carVoList ...

  4. 洛谷P1029 最小公约数和最大公倍数问题【数论】

    题目:https://www.luogu.org/problemnew/show/P1029 题意: 给定两个数$x$和$y$,问能找到多少对数$P$$Q$,使得他们的最小公约数是$x$最大公倍数是$ ...

  5. 网卡配置文件详解 用户管理与文件权限篇 文件与目录权限 软连接 tar解压命令 killall命令 linux防火墙 dns解析设置 计划任务crond服务 软件包安装 阿里云 yum源 安装

    Linux系统基础优化及常用命令 Linux基础系统优化 引言没有,只有一张图. Linux的网络功能相当强悍,一时之间我们无法了解所有的网络命令,在配置服务器基础环境时,先了解下网络参数设定命令. ...

  6. angular4 辅助路由

    1.辅助路由 2. 创建chat组件 ng g component chat 3. 组件html css: 1 2 3 4 5 6 7 .chat{   background:green;   hei ...

  7. 2012年蓝桥杯省赛A组c++第3题(喝断片的海盗)

    /* 有一群海盗(不多于20人),在船上比拼酒量.过程如下:打开一瓶酒, 所有在场的人平分喝下,有几个人倒下了.再打开一瓶酒平分,又有倒下的, 再次重复...... 直到开了第4瓶酒,坐着的已经所剩无 ...

  8. json序列化以及反序列化存在多个对象时候的处理

    存在多个对象的时候,只需要将反序列化存在的对象,遍历出来即可. using System;using System.Collections.Generic;using System.Linq;usin ...

  9. CS231n: Convolutional Neural Networks for Visual Recognition

    https://zhuanlan.zhihu.com/p/28522637 https://zhuanlan.zhihu.com/p/21930884 mark

  10. LeetCode 973 K Closest Points to Origin 解题报告

    题目要求 We have a list of points on the plane.  Find the K closest points to the origin (0, 0). (Here, ...