首页 > 代码库 > tomcat中JDK安装
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
[root@qiangge 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
[root@qiangge src]# . /etc/profile.d/java.sh (文件初始化)
[root@qiangge 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。以前安装开发坏境的时候自动安装的,建议去官网下载独立安装较好。
[root@qiangzi src]# which java (查看之前安装版路径)
/usr/bin/java
[root@qiangzi 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
红色部分为之前安装的版本
[root@qiangzi src]# yum remove java-1.6.0-openjdk* java-1.7.0-openjdk* (卸载多余版本)
[root@qiangzi src]# java -version (验证是否成功)
-bash: /usr/bin/java: 没有那个文件或目录
[root@qiangge src]# . /etc/profile.d/java.sh (文件初始化)
[root@qiangge 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安装