installing java and maven on CentOS

java, maven

installed java:

yum install java-1.6.0-openjdk

yum install java-1.6.0-openjdk-devel
installed maven:
wget http://ftp.tsukuba.wide.ad.jp/software/apache/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
tar xzvf apache-maven-3.0.4-bin.tar.gz
mv apache-maven-3.0.4 /usr/local
cd /usr/local
ln -s apache-maven-3.0.4 maven
vim ~/.bashrc
>> added:
export M2_HOME=/usr/local/maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
touch /etc/profile.d/maven.sh
>> added:
export M2_HOME=/usr/local/maven

export PATH=${M2_HOME}/bin:${PATH}