tomcat中JDK安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat中JDK安装相关的知识,希望对你有一定的参考价值。
tomcat中JDK安装
Tomcat的安装分为两个步骤:安装JDK和安装Tomcat.
JDK(Java Development Kit)是Sun Microsystems针对Java开发员的产品。自从Java推出以来,JDK已经成为使用最广泛的Java SDK. JDK是整个Java的核心,包括了Java运行环境,Java工具和Java基础的类库。所以要想运行jsp的程序必须要有JDK的支持,理所当然安装Tomcat的前提是安装好JDK.
安装JDK
下载jdk-6u23-linux-i586.bin
#cd /usr/local/src/ #wget http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-i586.tar.gz?AuthParam=1494760734_dfbbaa8a58b360932580ed99fb64e772
也可以从官方网站(http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html)下载其他版本。
#tar zxvf jdk-8u131-linux-i586.tar.gz
# mv jdk1.8.0_131 /usr/local/
# ls /usr/local/
apache2 etc include lib man nginx sbin src
bin games jdk1.8.0_131 libexec mysql php share
[[email protected] src]#vi /etc/profile.d/java.sh
JAVA_HOME=/usr/local/jdk1.8.0_131/
JAVA_BIN=/usr/local/jdk1.8.0_131/bin
JRE_HOME=/usr/local/jdk1.8.0_131/jre
PATH=$PATH:/usr/local/jdk1.8.0_131/bin:/usr/local/jdk1.8.0_131/jre/bin
CLASSPATH=/usr/local/jdk1.8.0_131/jre/lib:/usr/local/jdk1.8.0_131/lib:/usr/local/jdk1.8.0_131/jre/lib/charsets.jar
export JAVA_HOME JAVA_BIN JRE_HOME PATH CLASSPATH
:wq
[[email protected] src]# . /etc/profile.d/java.sh (文件初始化)
[[email protected] src]# java -version (验证是否成功)
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Server VM (build 25.131-b11, mixed mode)
如显示版本信息与安装版本不符,那就说明之前安装过Java,所以需要卸载之前安装的Java。以前安装开发坏境的时候自动安装的,建议去官网下载独立安装较好。
[[email protected] src]# which java (查看之前安装版路径)
/usr/bin/java
[[email protected] src]# yum list |grep jdk
java-1.6.0-openjdk.i686 1:1.6.0.0-1.66.1.13.0.el6 @anaconda-CentOS-201311271240.i386/6.5
java-1.6.0-openjdk-devel.i686 1:1.6.0.0-1.66.1.13.0.el6 @anaconda-CentOS-201311271240.i386/6.5
java-1.7.0-openjdk.i686 1:1.7.0.45-2.4.3.3.el6 @anaconda-CentOS-201311271240.i386/6.5
java-1.7.0-openjdk-devel.i686 1:1.7.0.45-2.4.3.3.el6 @anaconda-CentOS-201311271240.i386/6.5
copy-jdk-configs.noarch 1.3-1.el6 base
java-1.6.0-openjdk.i686 1:1.6.0.41-1.13.13.1.el6_8 base
java-1.6.0-openjdk-demo.i686 1:1.6.0.41-1.13.13.1.el6_8 base
java-1.6.0-openjdk-devel.i686 1:1.6.0.41-1.13.13.1.el6_8 base
java-1.6.0-openjdk-javadoc.i686 1:1.6.0.41-1.13.13.1.el6_8 base
java-1.6.0-openjdk-src.i686 1:1.6.0.41-1.13.13.1.el6_8 base
java-1.7.0-openjdk.i686 1:1.7.0.141-2.6.10.1.el6_9 updates
java-1.7.0-openjdk-demo.i686 1:1.7.0.141-2.6.10.1.el6_9 updates
java-1.7.0-openjdk-devel.i686 1:1.7.0.141-2.6.10.1.el6_9 updates
java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.141-2.6.10.1.el6_9 updates
java-1.7.0-openjdk-src.i686 1:1.7.0.141-2.6.10.1.el6_9 updates
java-1.8.0-openjdk.i686 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-debug.i686 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-demo.i686 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-demo-debug.i686 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-devel.i686 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-devel-debug.i686 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-headless.i686 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-headless-debug.i686 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-src.i686 1:1.8.0.131-0.b11.el6_9 updates
java-1.8.0-openjdk-src-debug.i686 1:1.8.0.131-0.b11.el6_9 updates
ldapjdk.i686 4.18-8.el6 base
ldapjdk-javadoc.i686 4.18-8.el6 base
红色部分为之前安装的版本
[[email protected] src]# yum remove java-1.6.0-openjdk* java-1.7.0-openjdk* (卸载多余版本)
[[email protected] src]# java -version (验证是否成功)
-bash: /usr/bin/java: 没有那个文件或目录
[[email protected] src]# . /etc/profile.d/java.sh (文件初始化)
[[email protected] src]# java -version (验证是否成功)
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Server VM (build 25.131-b11, mixed mode)
本文出自 “12350027” 博客,谢绝转载!
以上是关于tomcat中JDK安装的主要内容,如果未能解决你的问题,请参考以下文章