The first step is to download the Java 7 Development Kit as follows (you can directly paste it into the download tool ):
Step 1
Download the Java 7 Development Kit as follows (you can paste it directly to the download tool ):
Http://download.Oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz
Step 2 extract Sudo tar -Zxvf. / Jdk- 7 -Linux-i586.tar.gz-C/home/wfl/programs // decompress the file/ Under the home/wfl/programs directory Step 3 modify Environment Variables
sudo gedit ~/.bashrc
Add the following content
export JAVA_HOME=/home/wfl/programs/jdk1.7.0 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
Save and make it take effect
source ~/.bashrc
Step 4 configure the default program
sudo update-alternatives --install /usr/bin/java java /home/wfl/programs/jdk1.7.0/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /home/wfl/programs/jdk1.7.0/bin/javac 300
sudo update-alternatives --config java
If another jdk is installed in your system, the system will prompt you to select jdk 7.
Final Test ResultsLinuxidc@www.linuxidc.com :~ $ Java-version
Java version "1.7.0"
Java (TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot (TM) Client VM (build 21.0-b17, mixed mode)