标签归档:jdk

linux下jdk+ant安装

下载JDK安装jdk

可以将url换成其他版本,URL在http://www.oracle.com/technetwork/java/javaee/downloads/index.htm

mkdir -p /opt/java
cd /opt/java
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin"
chmod u+x jdk-6u45-linux-x64.bin
ln -s jdk-6u45-linux-x64 default

下载安装ant

wget http://mirrors.cnnic.cn/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz
tar zxf apache-ant-1.9.4-bin.tar.gz 
ln -s apache-ant-1.9.4 ant

修改profile

vim /etc/profile.d/sun-jdk.sh

export JAVA_HOME=/opt/java/default
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:.
export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:.:$CLASSPATH

# ant
export ANT_HOME=/opt/java/ant
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:.:$ANT_HOME/bin