1. download jdk
jdk-7u60-linux-x64.tar.gz
2. unzip jdk-file to /usr/lib/jvm/.
/usr/lib/jvm/jdk1.7.0_60
3. set environment
vi /etc/profile, add
#set java environment
export
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_60
export JRE_HOME=$JAVA_HOME/jre
export
CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
4. enable profile
execute
source /etc/profile
to enable java environment
5. set default app
update-alternatives --install /usr/bin/java java
/usr/lib/jvm/jdk1.7.0_60/bin/java 17060
update-alternatives --install /usr/bin/javac javac
/usr/lib/jvm/jdk1.7.0_60/bin/javac 17060
update-alternatives --config java
6. check the installation with:
java -version
时间: 2024-11-05 21:42:31