Linux系统下JDK安装配置
1. 从oracle网站下载需要的JDK软件 :jdk-6u39-linux-i586.bin
http://www.oracle.com/technetwork/java/javase/archive-139210.html
然后通过FTP上传到linux服务器上。
2. 将文件copy到/usr目录下
[[email protected] wendy]# cp jdk-6u39-linux-i586.bin /usr/
3. 给文件添加执行权限:
[[email protected] wendy]# cd /usr/
[[email protected] usr]# chmod +x jdk-6u39-linux-i586.bin
4. 执行安装:
[[email protected] usr]# ./ jdk-6u39-linux-i586.bin
安装完成后在/usr/目录下生成jdk1.6.0_39目录,就是JDK的安装目录。
5. 设置环境变量:
[[email protected] usr]# vi /etc/profile
export JAVA_HOME=/usr/ jdk1.6.0_39
export JRE_HOME=/usr/ jdk1.6.0_39/jre
export PATH=$PATH:/usr/ jdk1.6.0_39/bin
export CLASSPATH=./:/usr/ jdk1.6.0_39/lib:/usr/ jdk1.6.0_39/jre/lib
保存退出,重启电脑
6. 测试
新建test.java
[[email protected] usr]# vi test.java
public class test{
public static void main(String[] args){
System.out.println("Hello,Welcome to Linux World!");
}
}
保存退出,下面来编译、执行;
[[email protected] usr]# javac test.java
[[email protected] usr]# java test
Hello,Welcome to Linux World!
配置成功!
如不能通过编译,可通过重新启动系统试试
7. 用 java –version 查看java版本,发现不是我安装的1.6.0_39
[[email protected] ~]# java -version
java version "1.4.2_27"
[[email protected] ~]# rpm –qa | grep java //原来之前已安装java rpm包
java-1.4.2-gcj-compat-1.4.2.0-27jpp
gcc-java-3.4.6-3.1
[[email protected] ~]# rpm –e java-1.4.2-gcj-compat-1.4.2.0-27jpp –nodeps
//删掉之前安装的版本
[[email protected] ~]# java -version
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode, sharing)
Linux系统下Tomcat安装
软件apache-tomcat-6.0.35.tar.gz
通过FTP上传到linux服务器上。
[[email protected] wendy]# tar –zxvf apache-tomcat-6.0.35.tar.gz
[[email protected] wendy]# mv apache-tomcat-6.0.35 /usr/local/tomcat
[[email protected] wendy]# cd /usr/local/tomcat/bin
[[email protected] bin]# ./startup.sh //启动tomcat
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:
/usr/jdk1.6.0_39/jre
Using CLASSPATH:
/usr/local/tomcat/bin/bootstrap.jar
[[email protected] bin]# vi /etc/profile
TOMCAT_HOME=/usr/local/tomcat
export TOMCAT_HOME
Tomcat报错:
log4j:ERROR
LogMananger.repositorySelector
was null likely
due to
error
in class
reloading, using
NOPLoggerRepository.
[[email protected] ~]# vi /usr/local/tomcat/conf/catalina.properties
//增加一行如下:
org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
Linux系统下JDK和Tomcat安装配置,布布扣,bubuko.com