关键词:
前言
JDK是 JAVA
的软件开发工具包,如果要使用JAVA来进行开发,或者部署基于其开发的应用,那么就需要安装JDK。本次将在Linux下安装JDK及配置环境。
本人环境:CentOS 7.3 64位
下载JDK
在安装之前,检查是否存在Linux下自带的OpenJDK,命令:rpm -qa | grep java。若存在,则需要进行卸载,命令:rpm -e --nodeps 卸载的软件名。
JDK历史版本链接:https://www.oracle.com/technetwork/java/javase/archive-139210.html
接着,我们可以通过 wget
命令下载JDK安装包,或者下载后传到Linux。我这里下载的安装包版本是 jdk-8u131-linux-x64.tar.gz
。
解压安装包
创建一个文件夹,用于存放JDK安装包,然后解压到该目录下。
创建文件夹:mkdir /root/JDK
进入文件夹:cd /root/JDK
解压:tar -zxvf /root/JDK/jdk-8u131-linux-x64.tar.gz
可以看到,本次解压到了当前目录 /root/JDK/jdk1.8.0_131
下。
配置环境
解压完成之后,我们要配置下环境变量,通过 vim
命令修改配置文件 /etc/profile
来设置环境变量。
vim /etc/profile
在文件最后一行,输入 insert
进入编辑模式,添加以下内容,然后按 Esc
退出编辑模式,再输入 :wq
保存并退出。
export JAVA_HOME=/root/JDK/jdk1.8.0_131
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
设置完之后,如果要使环境变量立即生效,需要通过命令:source /etc/profile
,重新加载配置文件。
验证是否安装成功
所有都配置好了,我们需要验证下是否安装成功。
依次输入 java -version
、java
、javac
,不会出现报错并且显示出 jdk版本号
及 java/javac相关命令参数说明界面
。
[root@wintest JDK]# java -version
-bash: java: command not found
[root@wintest JDK]# source /etc/profile
[root@wintest JDK]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
[root@wintest JDK]# java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
[root@wintest JDK]# 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@wintest JDK]#
linux下安装activemq并指定jdk1.8
1.下载安装包<apache-activemq-5.15.4-bin.tar.gz>下载地址:https://pan.baidu.com/s/18xzjBAchjWqsHNA1HuYvTg2.配置环境已安装jdk1.7&jdk1.8 PS:下载jdk1.8:①先查看name-a查看linux版本号【X86_64为64位系统-兼容32位】②oracle官网下载指定版本【 查看详情
工具安装——linux下安装jdk1.8
1、查看Linux环境自带JDK使用命令:#rpm-qa|grepgcj显示内容其中包含相应信息#java-x.x.x-gcj-compat-x.x.x.x-xxjpp#java-x.x.x-gcj-compat-devel-x.x.x.x-xxjpp 2、卸载#rpm-e --nodeps java-x.x.x-gcj-compat-x.x.x.x-xxjpp#rp 查看详情
如何在linux下安装jdk1.8
...一步:下载Linux环境下的jdk1.8,请去(官网)中下载jdk的安装文件;第二步:新建/usr/java文件夹,将jdk-8u25-linux-i586.tar.gz放到该文件夹中,并将工作目录切换到/usr/java目录下。第三步:通过以上步骤,jdk1.8就已经全部安装完成了... 查看详情
(linux)centos7下安装jdk1.8
...ml1、首先查看CentOS7是否有自带的JDK,一般Linux会自动下载安装OpenJDK1.1查看系统JDK版本java-version1.2查看系统自带JDK的相关信息rpm-qa|grepjavarpm 管理套件-qa 使用询问模式,查询所有套件grep 查找文件里符合条件的字符串ja 查看详情
1.linuxcentos6.8环境下安装jdk1.8
...官网下载jdk1.8的linux版本并上传到/usr/local目录下创建jdk的安装目录mkdir-p/usr/local/software/java将下载的tar包解压到指定目录下tar-xvf/usr/local/jdk-8u151-linux-x64.tar.gz-C/usr/local/software/java/设置环境变量,修改/etc/profile文件,添加如下 查看详情
centos下安装jdk1.8
Linux下卸载openjdk,安装jdk1.查看java版本java-versionopenjdkversion"1.8.0_171"OpenJDKRuntimeEnvironment(build1.8.0_171-b10)OpenJDK64-BitServerVM(build25.171-b10,mixedmode) 2.查看java安装软件rpm-qa|grepjavat 查看详情
linux安装jdk1.8
首先到官网下载 Linuxx64182.87MBjdk-8u191-linux-x64.tar.gzhttps://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html下载到一个目录下,然后用SecureCRTalt+p sftp>putD:/aas 查看详情
linux05_jdk1.8如何安装(代码片段)
软件地址链接:https://pan.baidu.com/s/1ew2CHuVrUvtQwX2UZ61T3g提取码:1234①.将文件传到/opt下,并解压: tar-zxvfjdk-8u152-linux-x64.tar.gz②.将解压的文件复制到/usr/local下,并改名为jdk1.8 cp-rvjdk1.8.0_152/usr/local cd/usr/local ll mvjdk1.8 查看详情
linux下yum安装jdk1.8(rpm包)和tomcat-8.5.11
...===0.java简介1)tomcat运行需要对应的Java环境,Java环境通过安装jdk来获得2)为了防止兼容性问题,tomcat和Java的版本最好对应,一般java-1.8对应tomcat8,java-1.7对应tomcat7,且高版本java可以支持低版本tomca 查看详情
centos下安装jdk1.8
CentOS6.5安装jdk1.81、源码包准备:首先到官网下载jdk-8u66-linux-x64.tar.gz,http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html2、解压源码包通过终端在/usr/local目录下新建java文件夹,命令行:sudomkdir/usr/local/ 查看详情
linux下源码安装jdk1.8和tomcat8.5
...境0.java简介1)tomcat运行需要对应的Java环境,Java环境通过安装jdk来获得2)为了防止兼容性问题,tomcat和Java的版本最好对应,一般java-1.8对应tomcat8,java-1.7对应tomcat7,且高版本java可以支持低版本tomcat3)Java安装包的命名方式:jdk-... 查看详情
linux系统下安装jdk1.8的教程详解(代码片段)
一,安装前的清理工作?123rpm-qa|grepjdkrpm-qa|grepgcjyum-yremovejava-xxx-xxx二,在线下载JDK命令:wget--no-check-certificate--no-cookies--header"Cookie:oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa801... 查看详情
linux下怎样安装jdk1.8?
JavaJDK8在Linux下的安装以及环境变量的配置1下载,根据Linux系统的位数选择,这里以后缀为.tar.gz的为例,.rpm的直接安装就是。2解压。3把解压后的文件夹放到/usr/local下面。(这个随便,任意目录下都可以)4在主目录下找到隐藏... 查看详情
linux,ubuntu20.04lts环境下安装jdk1.8和idea2021
本文内容是在x64基础上进行实现。1.下载JDKhttps://www.oracle.com/cn/java/technologies/javase/javase-jdk8-downloads.html选择jdk-8u291-linux-x64.tar.gz。2.下载完毕解压配置这里默认下载的路径是在Downloads在/usr/lib文件夹里创建jvm文件夹cd/usr/libmkdirjvm到 查看详情
redhat6.5安装jdk1.8
...下载JDK我下载的是jdk-8u131-linux-x64.tar.gz这个版本(下面的安装方式也是tar包的安装方式)2.通过XFtp将该压缩文件上传到Linux系统/usr/tmp目录下(这个是博主的选择,可以随意)3.安装之前我们检查下看系统有没有已经安装的jdk运行j... 查看详情
linux下安装jdkjmeter
...的jmeter5.0和jdk1.8版本1.登录Linux,使用root的用户2.进入jdk安装包、jmeter安装包所在的路径,进行解压tar-zxvf jdk-8u131-linux-i586.tar.gz解压后,得到文件夹:jdk1.8.0_131 unzip apache-jmeter-5.0.zip解压后得 查看详情
linux下javaweb服务器的搭建一(jdkmysqltomcat)(代码片段)
目录1、JDK1.8的安装配置1.1环境检查1.2JDK1.8的下载1.3JDK1.8的安装1.4JDK1.8的配置2、MySQL8的安装配置2.1环境检查2.2 mysql彻底卸载2.3下载MySQL8安装包2.4安装MySQL82.5MySQL8配置2.6 开启root远程访问2.7Ubuntu下打开3306防火墙2.8 Centos7打开3306防... 查看详情
ubuntu下安装jdk1.8和eclipse
配置jdk参考https://www.linuxidc.com/Linux/2017-02/140908.htm需要配置/etc/environment,配置完如下所示PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$JAVA_HOME/bin"export 查看详情