I'll describe two ways to install the JDK.
Manually download and install the jdk from oracle
1) Download the jdk<version>.tar.gz from Oracle.
2) Navigate to the downloaded file and extract it: tar -xf jdk-7u4-linux-i586.tar.gz
3) Decide where to install the new JDK. I prefer to install the new JDK in /usr/lib/jvm
4) Now move the extracted JDK folder to that location.
5) We have to refer to the newly installed JDK and the Firefox Java Plugin (in order the use java applets):
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk
<version>
/bin/java" 1 sudo update-alternatives --config java sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk
<version>
/jre/lib/i386/libnpjp2.so" 1 sudo update-alternatives --config mozilla-javaplugin.so
6) Test your java installation by typing into a terminal:
java -version
7) Finally you have to set the JAVA_HOME variable by adding the following two lines to the file .bashrc
This approach, however, has a little problem. Whenever you decide to update your current JDK you have to reconfigure the system to use the updated version of your JDK.
Solution: Just make a symlink /usr/lib/jvm/jdk which points to /usr/lib/jvm/jdk<version>.
update-alternatives schould refer to this symlink. After you've updated your JDK all you have to do is to update the symlink to the new installed JDK location/name.
Manually add the ppa repositories to te software sources
This is the second approach to install the Oracle JDK. With this approach you can stay up to date to the latest Oracle Java Version. Just run the following commands as root:
Source: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html
Greets!
7) Finally you have to set the JAVA_HOME variable by adding the following two lines to the file .bashrc
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_04/
export JAVA_HOME
Done!This approach, however, has a little problem. Whenever you decide to update your current JDK you have to reconfigure the system to use the updated version of your JDK.
Solution: Just make a symlink /usr/lib/jvm/jdk which points to /usr/lib/jvm/jdk<version>.
update-alternatives schould refer to this symlink. After you've updated your JDK all you have to do is to update the symlink to the new installed JDK location/name.
Manually add the ppa repositories to te software sources
This is the second approach to install the Oracle JDK. With this approach you can stay up to date to the latest Oracle Java Version. Just run the following commands as root:
su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer
exit
Source: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html
Greets!
No comments:
Post a Comment