ubuntu下java和tomcat安装配置

时间:2022-12-05 19:14:43
  1. oracle下载jdk-7u51-linux-i586.tar.gz
  2. sudo cp Downloads/jdk-7u51-linux-i586.tar.gz /usr/local/java //拷贝
    sudo tar -zxvf jdk-7u51-linux-i586.tar.gz//解压
  3. sudo vim ~/.bashrc
    export JAVA_HOME="/usr/local/java/jdk1.7.0_79"
    export JAVA="/usr/local/java/jdk1.7.0_79"
    export JRE_HOME="/usr/local/java/jdk1.7.0_79"
    export CLASSPATH=.:\(JAVA_HOME/lib:\)JRE_HOME/lib
    export PATH=\(JAVA_HOME/bin:/sbin:\)PATH
    source ~/.bashrc

  4. sudo mkdir /usr/local/tomcat //这个看自己,按理说在哪个目录下都是可以的,本人推荐这个
    sudo cp ~/Downloads/apache-tomcat-6.0.39.tar.gz /usr/local/tomcat//将刚下载的复制或者移动到制定目录下
    sudo tar -zxvf apache-tomcat-6.0.39.tar.gz //解压
    //接下来就是配置了
    cd apache-tomcat-6.0.39/bin //进入到这个目录里面
    sudo vim setclasspath.sh //在文件头加上JAVA_HOME环境变量就行了
    export JAVA_HOME=/usr/local/java/jdk1.7.0_79
    export JRE_HOME=/usr/local/java/jdk1.7.0_79

5.sudo ./startup.sh