Downloading
Download the latest version of JDK from http://www.java.sun.com. I have downloaded jdk-1_5_0_01-linux-i586.bin for this tutorial.
Installing
Change to the directory where you downloaded the JDK ( I downloaded it in my home directory /home/alpesh) and make the self-extracting binary executable:
chmod +x jdk-1_5_0_01-linux-i586.binRun the self-extracting binary, this will display the License agreement text and will ask you to accept the agreement:
./jdk-1_5_0_01-linux-i586.bin
Above command should create a directory called jdk1.5.0_01 in the /home/alpesh directory. Move the JDK directory to /opt . Here is the command used:
mv jdk1.5.0_01 /opt
Set the JAVA_HOME environment variable, by modifying /etc/profile so it includes the following:
JAVA_HOME="/opt/jdk1.5.0_01"
export JAVA_HOME
save /etc/profile file. Then run following command to take into effect.
source /etc/profile
Check to make sure JAVA_HOME is defined correctly using the command below. You should see the path to your Java JDK.
echo $JAVA_HOME
Output should be
/opt/jdk1.5.0_01
Now need to set out new Java as default thorugh alternative utility. First we will install alternative java then we will configure it make it as default java.
To install java using alternative command:
alternatives --install /usr/bin/java java /opt/jdk1.5.0_01/bin/java 2
Now need to configure it to make it as default Java location:
alternatives -config java
Above command will give below output. There we will have to select latest java location.
[root@alpeshpc opt]# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /opt/jdk1.5.0_01/bin/java
Give there number 2, then press enter.
Thats it.
Now you can check Java installation using java –version command.
Download the latest version of JDK from http://www.java.sun.com. I have downloaded jdk-1_5_0_01-linux-i586.bin for this tutorial.
Installing
Change to the directory where you downloaded the JDK ( I downloaded it in my home directory /home/alpesh) and make the self-extracting binary executable:
chmod +x jdk-1_5_0_01-linux-i586.binRun the self-extracting binary, this will display the License agreement text and will ask you to accept the agreement:
./jdk-1_5_0_01-linux-i586.bin
Above command should create a directory called jdk1.5.0_01 in the /home/alpesh directory. Move the JDK directory to /opt . Here is the command used:
mv jdk1.5.0_01 /opt
Set the JAVA_HOME environment variable, by modifying /etc/profile so it includes the following:
JAVA_HOME="/opt/jdk1.5.0_01"
export JAVA_HOME
save /etc/profile file. Then run following command to take into effect.
source /etc/profile
Check to make sure JAVA_HOME is defined correctly using the command below. You should see the path to your Java JDK.
echo $JAVA_HOME
Output should be
/opt/jdk1.5.0_01
Now need to set out new Java as default thorugh alternative utility. First we will install alternative java then we will configure it make it as default java.
To install java using alternative command:
alternatives --install /usr/bin/java java /opt/jdk1.5.0_01/bin/java 2
Now need to configure it to make it as default Java location:
alternatives -config java
Above command will give below output. There we will have to select latest java location.
[root@alpeshpc opt]# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
2 /opt/jdk1.5.0_01/bin/java
Give there number 2, then press enter.
Thats it.
Now you can check Java installation using java –version command.
Now you can check Java installation using java –version command.
- You may come across issue, even if java installed but your browser will give warning that java is not installed. So you will need to follow below steps to make java applet work in browser.
Note: You may have different java version, so change java version accordingly in below commands.
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.6.0_33/jre/lib/i386/libnpjp2.so 20000
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk1.6.0_33/jre/lib/amd64/libnpjp2.so 20000
Nice post !!! Very useful for nowise !!
ReplyDelete