一、前期准备

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. C#调用VB进行简繁转换

    首先在C#项目中引用Microsoft.VisualBasic.dll,版本自己选择合适的 然后在项目中添加引用:using Microsoft.VisualBasic; 转换: 转为繁体: outp ...

  2. Nordic NRF51822 从零开始系列(外部设备片—MPU6050DMP驱动的移植)

    一.硬件准备             (1)开发板和软件参看 Nordic NRF51822 从零开始系列(一)开发环境的搭建             (2)mpu6050模块 二.前置知识     ...

  3. Docker Compose一键部署Nginx反向代理Tomcat集群

    目录结构如下 mysql/conf/my.cnf [mysqld] user=mysql port=3306 datadir=/var/lib/mysql socket=/var/lib/mysql/ ...

  4. 跳石头|河中跳房子|NOIP2015提高组T4|二分法

    喵 提交地址:http://codevs.cn/problem/4768/ 题目: 题意:自己看 思路: 1.读入各个石头数据 2.直接二分答案: 枚举一个石头i和一个石头j,要求i和j之间的距离为m ...

  5. MySQL服务器线程数的查看方法详解

    本文实例讲述了MySQL服务器线程数的查看方法.分享给大家供大家参考,具体如下: mysql重启命令: ? 1 /etc/init.d/mysql restart MySQL服务器的线程数需要在一个合 ...

  6. c#如何调用另外一个项目的类

    添加引用即可. 参考资料: https://zhidao.baidu.com/question/241402877.html http://blog.csdn.net/a1027/article/de ...

  7. dp单调性优化

    跟着书上的思路学习dp的单调性优化觉得还是很容易想的. 数据范围: dp,数据范围是百万,这应该是O(n)的算法了. 首先不难想到设f[i]表示到第i个百米所能达到的最大能量,那么f[n]即为所求. ...

  8. 虚拟机VirtualBox与CentOS 7安装

    一.VirtualBox 我们电脑的操作系统一般都是Windows,如果我们要学习Linux,那么可以在我们的电脑上装个虚拟机,然后在这虚拟机上安装Linux.虚拟机可以用VirtualBox 或者 ...

  9. redis分布式锁(转)

    add by zhj: 如果不考虑键的删除,而是让他过期后自动失效,那用set就可以实现锁了 原文:http://www.cnblogs.com/yjf512/archive/2017/03/22/6 ...

  10. Innodb buffer 相关参数

    buffer相关参数: show GLOBAL VARIABLES LIKE 'innodb_buffer_pool_instances'; show GLOBAL VARIABLES LIKE 'i ...