Fedora 安装 JDK 和 Tomcat 和 Maven

去oracle官网下载jdk-linux-rpm.bin

去tomcat官网下载个tomcat6

去Maven官网下载Maven3

安装JDK:

命令:$sh ./jdk-linux-rpm.bin

tomcat安装:

直接解压即可.

tomcat自动启动:

1、把下面的代码保存为tomcat文件,并让它成为可执行文件 chmod 755 tomcat.
#!/bin/bash
#
# kenny kenny.zhou@tom.com
# /etc/rc.d/init.d/tomcat
# init script for tomcat precesses
#
# processname: tomcat
# description: tomcat is a j2se server
# chkconfig: 2345 86 16
# description:  Start up the Tomcat servlet engine.

if [ -f /etc/init.d/functions ]; then
        . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
        . /etc/rc.d/init.d/functions
else
        echo -e "\atomcat: unable to locate functions lib. Cannot continue."
        exit -1
fi

RETVAL=$?
CATALINA_HOME="/usr/local/tomcat"

case "$1" in
start)
        if [ -f $CATALINA_HOME/bin/startup.sh ];
          then
            echo $"Starting Tomcat"
            $CATALINA_HOME/bin/startup.sh
        fi
        ;;
stop)
        if [ -f $CATALINA_HOME/bin/shutdown.sh ];
          then
            echo $"Stopping Tomcat"
            $CATALINA_HOME/bin/shutdown.sh
        fi
        ;;
*)
        echo $"Usage: $0 {start|stop}"
        exit 1
        ;;
esac

exit $RETVAL
2、将tomcat文件拷贝到/etc/init.d/下,并运行:chkconfig --add tomcat
3、在tomcat/bin/catalina.sh文件中加入以下语句:
export JAVA_HOME=/YOURPATH/tomcat/jdk
export CATALINA_HOME=/YOURPATH/tomcat
export CATALINA_BASE=/YOURPATH/tomcat
export CATALINA_TMPDIR=/YOURPATH/tomcat/temp

启动tomcat: service tomcat start
停止tomcat:  service tomcat stop

tomcat编码问题:

在server.xml中设置为

<Connector port="8080" protocol="HTTP/1.1" URIEncoding="UTF-8" connectionTimeout="20000" redirectPort="8443" />

则默认的编码就为UTF-8了

Maven安装:

直接解压即可.

环境配置

#系统环境path
PATH=$PATH:$HOME/bin
export PATH
#自定义系统path
JAVA_HOME=/usr/java/jdk1.6.0_24
#maven配置
MAVEN_HOME=/home/lxx/java/apache-maven-3.0.3
PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$HOME/bin
CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:.
CATALINA_HOME=/home/lxx/java/apache-tomcat-6.0.32
export CATALINA_HOME
export CLASSPATH
export JAVA_HOME MAVEN_HOME
export PATH

需要注意的是PATH必须加上$PATH:才行,这是链接上以前输出的PATH,否者,PATH将会被重写

posted @ 2011-04-05 15:27  `X.x|嚨  阅读(1407)  评论(0编辑  收藏  举报