天天看點

centos7 java1.8解除安裝_Centos7下安裝與解除安裝Jdk1.8

Centos7下安裝與解除安裝Jdk1.8

檢視已經安裝的jdk

[[email protected] 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

解除安裝指令

[[email protected] jre]# yum -y remove java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64

解除安裝完成之後Java指令不被識别

[[email protected] lib]# java -version

bash: java: command not found…

安裝

去官網下載下傳jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

解壓到安裝目錄

[[email protected] software]# tar -zxvf jdk-8u101-linux-x64.tar.gz -C /usr/local/java/

安裝完畢之後在/etc/profile檔案末尾添加

[[email protected] 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生效

[[email protected] jdk1.8.0_101]# source /etc/profile

檢測安裝是否成功

[[email protected] 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)

[[email protected] jdk1.8.0_101]# javac

Usage: javacwhere 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 Specify where to find user class files and annotation processors

-cp Specify where to find user class files and annotation processors

-sourcepath Specify where to find input source files

-bootclasspath Override location of bootstrap class files

-extdirs Override location of installed extensions

-endorseddirs Override location of endorsed standards path

-proc:{none,only}          Control whether annotation processing and/or compilation is done.

-processor [,,…] Names of the annotation processors to run; bypasses default discovery process

-processorpath Specify where to find annotation processors

-parameters                Generate metadata for reflection on method parameters

-d Specify where to place generated class files

-s Specify where to place generated source files

-h Specify where to place generated native header files

-implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files

-encoding Specify character encoding used by source files

-source Provide source compatibility with specified release

-target Generate class files for specific VM version

-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

-JPass directly to the runtime system

-Werror                    Terminate compilation if warnings occur

@Read options and filenames from file