码迷,mamicode.com
首页 > 系统相关 > 详细

Linux-JDK安装

时间:2019-12-22 20:08:45      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:mode   ora   processor   行编辑   NPU   ase   环境变量   var   key   

1、下载

去oracle官网下载jdk https://www.oracle.com/technetwork/cn/java/javase/downloads/jdk8-downloads-2133151-zhs.html

我使用的是 jdk-8u201-linux-x64.tar.gz

2、解压

我解压到了/opt/software目录

[root@localhost package]# tar -zxvf jdk-8u201-linux-x64.tar.gz -C /opt/software/

3、配环境变量

/etc/profile文件的改变会涉及到系统的环境,我们要将jdk配置到/etc/profile,才可以在任何一个目录访问jdk

编辑文件

[root@localhost jdk1.8.0_201]# vim /etc/profile

按Shift+G到文件末尾,按o向下一行编辑,粘贴下面内容。

export JAVA_HOME=/opt/software/jdk1.8.0_201  #jdk安装目录
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}

wq保存退出。

编辑后生效

[root@localhost jdk1.8.0_201]# source /etc/profile

4、检测

输入javac 或者 java -version

[root@localhost jdk1.8.0_201]# 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
[root@localhost jdk1.8.0_201]# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

Linux-JDK安装

标签:mode   ora   processor   行编辑   NPU   ase   环境变量   var   key   

原文地址:https://www.cnblogs.com/AganRun/p/12080701.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!