Download the package from http://oracle.com/java under the same terms as users on other platforms. Here is the direct link to JavaSE downloads.
Coming the point I have downloaded JDK 7 (update 4) for Linux x86 (32-bit) – file: jdk-7u21-linux-i586.tar.gz
Step 1:
After downloading the file open the terminal and navigate to the file
tar -xf jdk-7u21-linux-i586.tar.gz
This will extract and create a jdk folder at your current path.
Step 2:
Create a location to keep your new JDK . I prefer and usually use /usr/lib/jvm/
You may need root permission to create the /usr/lib/jvm (hence use sudo).
sudo mkdir /usr/lib/jvm
Step 3: Move the extracted jdk folder to /usr/lib/jvm/
sudo mv jdk1.7.0_21 /usr/lib/jvm/
Step 4: Now we have to setup our system to use refer to our new jdk
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java" 1
sudo update-alternatives --config java
And also register Firefox Java Plugin
sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" \
"mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.7.0_21/jre/lib/i386/libnpjp2.so" 1
sudo update-alternatives --config mozilla-javaplugin.so
ALL DONE. You can test your java install by
java -version
Finally if you need to add JAVA_HOME variable, you can do so by adding it to the .bashrc file in your home directory
Open .bashrc file using an editor. If you use VI then
vi ~/.bashrc
and add the following 2 lines in your .bashrc file.
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21/
export JAVA_HOME
There may be other ways to install, but this is what I have followed always.
Cheers
Coming the point I have downloaded JDK 7 (update 4) for Linux x86 (32-bit) – file: jdk-7u21-linux-i586.tar.gz
Step 1:
After downloading the file open the terminal and navigate to the file
tar -xf jdk-7u21-linux-i586.tar.gz
This will extract and create a jdk folder at your current path.
Step 2:
Create a location to keep your new JDK . I prefer and usually use /usr/lib/jvm/
You may need root permission to create the /usr/lib/jvm (hence use sudo).
sudo mkdir /usr/lib/jvm
Step 3: Move the extracted jdk folder to /usr/lib/jvm/
sudo mv jdk1.7.0_21 /usr/lib/jvm/
Step 4: Now we have to setup our system to use refer to our new jdk
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java" 1
sudo update-alternatives --config java
And also register Firefox Java Plugin
sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" \
"mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.7.0_21/jre/lib/i386/libnpjp2.so" 1
sudo update-alternatives --config mozilla-javaplugin.so
ALL DONE. You can test your java install by
java -version
Finally if you need to add JAVA_HOME variable, you can do so by adding it to the .bashrc file in your home directory
Open .bashrc file using an editor. If you use VI then
vi ~/.bashrc
and add the following 2 lines in your .bashrc file.
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21/
export JAVA_HOME
There may be other ways to install, but this is what I have followed always.
Cheers
Thank you for such a wonderful Information !!
ReplyDeleteHere is a list of Top LINUX INTERVIEW QUESTIONS
SAMBA Server Interview Questions
Linux FTP vsftpd Interview Questions
SSH Interview Questions
Apache Interview Questions
Nagios Interview questions
IPTABLES Interview Questions
Ldap Server Interview Questions
LVM Interview questions
Sendmail Server Interview Questions
YUM Interview Questions
NFS Interview Questions
Read More at :- Linux Troubleshooting