ubuntu手动安装jdk并配置jetty

1. 获取和安装jdk1.6

cd ~/downloads
wget -c http://download.oracle.com/otn-pub/java/jdk/6u32-b05/jdk-6u32-linux-x64.bin
sudo cp jdk-6u32-linux-x64.bin /usr/local/bin/
chmod u+x jdk-6u32-linux-x64.bin
sudo -s ./jdk-6u32-linux-x64.bin

2. 修改环境变量

vi ~/.bashrc

在末尾添加

export JAVA_HOME=/usr/local/bin/jdk1.6.0_32
export JRE_HOME=${JAVA_HOME}/jre  
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
export PATH=${JAVA_HOME}/bin:$PATH  

保存,用下列命令使之生效

source ~/.bashrc  

3. 测试jdk

java -version

如果看到

java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)

说明安装成功。

4. 安装jetty

cd ~/downloads
wget -c http://dist.codehaus.org/jetty/jetty-hightide-8.0.0/jetty-hightide-8.0.0.v20110901.tar.gz
sudo mkdir /etc/jetty
sudo cp jetty-hightide-8.0.0.v20110901.tar.gz /etc/jetty/
cd /etc/jetty
sudo tar -xzvf jetty-hightide-8.0.0.v20110901.tar.gz
sudo mv jetty-hightide-8.0.0.v20110901 ../jetty8
cd ..
sudo rm -R jetty

5. 运行jetty

cd /etc/jetty8
java -jar start.jar

此时,应可访问服务器8080端口,可以看到jetty的默认页面

  

posted @ 2012-05-29 21:58  傲雪啸风  阅读(760)  评论(0编辑  收藏  举报