自从2014年3月19日甲骨文公司发布Java 8.0的正式版以来,面向对象的Java语言不仅朝着一个更好的方向发展,而且吸取了当前比较流行的函数式编程的特性——Java 8.0加入了函数式编程的特点。可以说是Java 8比Java 7有一个更好的性质。今天我将为大家演示一下Jdk 8在CentOS 7的安装与配置:

一、前期准备

环境:最小安装的CentOS 7(虚拟机安装的新版的centos系统,与6有一些配置文件上的差异),提前装好了lrssz工具(不会安装的,可以参看我的另一篇随笔——lrssz的安装)。

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。

注意:上面这两步可以一次性完成,而且很简单哦!

rpm -e --nodeps `rpm -qa | grep java`

二、Jdk的安装

a)         我们登录超级用户,在超级用户目录root下建立一个目录app:

su root  #然后输入密码

mkdir app

b)         我们进入app,将下载好的jdk压缩包导入centos:

cd app

rz   #使用rz命令将jdk压缩包从window导入centos当下目录app中

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)         进入jdk文件夹,获取目录绝对路径(我的绝对路径是:/root/app/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

四、配置验证

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

-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

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

Jdk1.8在CentOS7中的安装与配置的更多相关文章

  1. Scala2.10.4在CentOS7中的安装与配置

    随着基于内存的大数据计算框架——spark的火爆流行,用于编写spark内核的Scala语言也随之流行开来.由于其编写代码的简洁性,受到了越来越多程序员的喜爱.我今天给大家展示的时Scala2.10. ...

  2. RabbitMQ3.9.7在CentOS7中的安装搭建

    1.概述 RabbitMQ 是目前很流行的消息中间件之一,可靠性非常好,能简单的实现高可用.负载均衡. 今天我们先来聊一下 RabbitMQ 3.9.7 版本在 CentOS7 中的安装. 2.安装R ...

  3. Apache系列:Centos7.2下安装与配置apache

    Centos7.2下安装与配置apache(一) 配置机:腾讯云服务器,centos7.2 一.安装Apache服务(Apache软件安装包叫httpd) yum install httpd -y 二 ...

  4. Linux中Nginx安装与配置详解

    转载自:http://www.linuxidc.com/Linux/2016-08/134110.htm Linux中Nginx安装与配置详解(CentOS-6.5:nginx-1.5.0). 1 N ...

  5. Centos7中离线安装DockerCE最新版

    一.简述 离线在Centos7中部署DockerCE. 二.步骤 (1)在有外网的计算A上执行: 1.配置安装源存放路径 mkdir -p /root/docker-ce-local &&am ...

  6. 分布式搜索引擎Elasticsearch在CentOS7中的安装

    1. 概述 随着企业业务量的不断增大,业务数据随之增加,传统的基于关系型数据库的搜索已经不能满足需要. 在关系型数据库中搜索,只能支持简单的关键字搜索,做不到分词和统计的功能,而且当单表数据量到达上百 ...

  7. 001 centos7中的安装

    以前学习过centos6.4的安装使用,然后新使用centos7,发现有些修改配置变化了,记录一下. 1.修改主机名 查看主机名: 修改: 二:ip的固定 1.参考文章 https://www.jia ...

  8. centos7 apache httpd安装和配置django项目

    一.安装httpd服务 apache在centos7中是Apache HTTP server.如下对httpd的解释就是Apache HTTP Server.所以想安装apache其实是要安装http ...

  9. [转]Centos7 fastdfs/nginx 安装与配置

    https://blog.csdn.net/alex_bean/article/details/78625131 参考文章 分布式文件系统-FastDFS 使用FastDFS搭建图片服务器单实例篇 C ...

随机推荐

  1. 模式识别之knn---KNN(k-nearest neighbor algorithm)--从原理到实现

    用官方的话来说,所谓K近邻算法,即是给定一个训练数据集,对新的输入实例,在训练数据集中找到与该实例最邻近的K个实例(也就是上面所说的K个邻居),这K个实例的多数属于某个类,就把该输入实例分类到这个类中 ...

  2. C# HttpClient请求

    using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; using System ...

  3. WAS7.0安装补丁升级程序无法替换文件 java/docs/autorun.inf解决办法

    OS:Win7 64bit WAS版本:WASND_7.0_Windows_x64_C1G2JML.zip WAS补丁升级程序版本:7.0.0.13-WS-UPDI-WinAMD64 异常信息: Ca ...

  4. Lemon OA第2篇:功能解析方法

    Lemon OA,整个系统功能也算是比较丰富,OA的很多功能都能看见影子,虽然做得不是很强大 接触Lemon OA,起源于Activiti的学习热情,既然这样,研究Lemon OA的目标有3: 1.L ...

  5. iOS: 动画更换 UIImageView 的 Image

    #import <QuartzCore/QuartzCore.h> ... imageView.image = [UIImage imageNamed:(i % ) ? @"3. ...

  6. zip压缩工具 tar打包 打包并压缩

    6.5 zip压缩工具 6.6 tar打包 6.7 打包并压缩 zip压缩工具 xz,bzip2,gzip都不支持压缩目录 zip可以压缩目录 压缩文件 zip  2.txt.zip  2.txt [ ...

  7. js设置随机切换背景图片

    <script> var imgs =["http://images.cnblogs.com/cnblogs_com/xiaobo-Linux/1112236/o_2.jpg&q ...

  8. 安卓开发笔记——TabHost组件(二)(实现底部菜单导航)

    上面文章<安卓开发复习笔记——TabHost组件(一)(实现底部菜单导航)>中提到了利用自定义View(ImageView+TextView)来设置一个底部菜单的样式 这边再补充一种更为灵 ...

  9. node.js和socket.io实现im

    im——Instant Messaging 即时通讯 基本技术原理 (1)通过IM服务器登陆或注销 (2)用户A通过列表找到B,用户B获得消息并与之交谈 (3)通过IM服务器指引建立与B单独的通讯通道 ...

  10. springmvc 文件下载

    1.使用servlet的API实现 参考:http://my.oschina.net/u/1394615/blog/311307 @RequestMapping("/download&quo ...