CentOS7安装Jdk1.8
一、前期准备
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的更多相关文章
- Centos7安装JDK1.8 Linux64bit
流程一览: 1.下载JDK1.8(jdk-8u11-linux-x64.tar.gz) 2. 解压缩安装 3.配置JAVA_HOME环境变量 4.切换JDK1.8为当前使用的JDK 5.重启,查看安装 ...
- centos7 安装 jdk1.8
首先是Linux的不同版本的额系统自带的配置是不一样的,比如centos6上有的自带的jdk环境的话要装1.8的就要进行卸载或者马上进行更改 jdk是java程序依赖的环境 首先查看你的系统下是否有j ...
- CentOS7安装JDK1.8图文教程
https://blog.csdn.net/weixin_42266606/article/details/80863781 1.下载 jdk 的 tar 包 网址:http://www.oracle ...
- centos7 安装jdk1.8
安装之前下熟悉以下连个文件 (1)/etc/profile 全局(公有)配置,不管是哪个用户,登录时都会读取该文件. (2)~/.bashrc: 该文件包含专用于你的bash shell的bas ...
- centos7安装jdk1.7(rpm版)
一.环境 centos7 jdk-7u80-linux-x64.rpm下载:链接:https://pan.baidu.com/s/10UMrxNE1d2ZbDt7kvBM1yQ 提取码:pmov ...
- Centos7安装jdk1.8并查找jdk安装目录
安装之前先检查一下系统有没有自带open-jdk rpm -qa |grep java rpm -qa |grep jdk rpm -qa |grep gcj 如果没有输入信息表示没有安装. 如果安装 ...
- centos7 安装Jdk1.8.0
不是很懂网上的文章...配置... 执行命令: rpm -qa|grep jdk 若无信息表明本机没装jdk. 执行安装命令: yum install -y java-1.8.0-openjdk-de ...
- CentOS7安装Elasticsearch5.5.3
一.准备 安装Java环境,elasticsearch推荐安装java1.8.0_131或更高的版本,安装教程CentOS7安装JDK1.8 二.安装 CentOS下可以选择.tar.gz或rpm方式 ...
- centos7安装配置jdk、tomcat
centos7安装jdk1.8 1.新建文件夹java,上传文件jdk-8u111-linux-x64.tar.gz到java文件夹 2.解压tar包: tar -zxvf jdk-8u111-lin ...
随机推荐
- 解决Hibernate:could not initialize proxy - no Session(申明:来源于网络)
解决Hibernate:could not initialize proxy - no Session 地址:http://blog.csdn.net/chenssy/article/details/ ...
- Docker容器集群管理之Swarm
Docker容器集群管理主流方案 Swarm Docker公司自研发的集群管理系统. Kubernetes Google开源的一个容器集群管理系统,用于自动化部署.扩展和管理容器应用.也称为K8S ...
- bootstrap 弹出框实现点击后打开离开后关闭
$("#PersonName").popover({ trigger: 'manual', placement: 'bottom', //title: '<div style ...
- Luogu 1603 - 斯诺登的密码 - [简单字符串操作]
题目链接:https://www.luogu.org/problemnew/show/P1603 题目背景 根据斯诺登事件出的一道水题 题目描述 2013年X月X日,俄罗斯办理了斯诺登的护照,于是他混 ...
- NLP任务:给定一句话,找出这句话中你想要的关键词,包括起始结束索引
在实际的nlp实际任务中,你有一大堆的人工标注的关键词,来新的一句话,找出这句话中的关键词,以便你以后使用,那如何来做呢? 1)用到正则的 finditer()方法,返回你匹配的关键词的迭代对象,包含 ...
- Sticks POJ - 1011 少林神棍 dfs四次剪枝
http://poj.org/problem?id=1011 题意:若干根棍子被截成小段的木棒,现在给你这些木棒,问最短可以拼出的棍子长度. 题解:搜索,dfs(r,m) 二个参数分别代表还剩r个木棒 ...
- webpack学习笔记-2-file-loader 和 url-loader
一 .前言 如果我们希望在页面引入图片(包括img的src和background的url).当我们基于webpack进行开发时,引入图片会遇到一些问题. 其中一个就是引用路径的问题.拿backgrou ...
- Exception 07 : org.hibernate.LazyInitializationException: could not initialize proxy - no Session
异常名称: org.hibernate.LazyInitializationException: could not initialize proxy - no Session 异常截图: 异常详情: ...
- MySQL服务器线程数的查看方法详解
本文实例讲述了MySQL服务器线程数的查看方法.分享给大家供大家参考,具体如下: mysql重启命令: ? 1 /etc/init.d/mysql restart MySQL服务器的线程数需要在一个合 ...
- AndroidStudio_RecyclerView
在这里回顾一下RecyclerView的用法 RecyclerView的用法与Button的用法很类似,只是要增加一个Adapter.java文件和item.xml文件 具体用法: 1.在page1. ...