How to change default JAVA of linux to lastet version:
----------------------------------------------------------------
First check all the executables as mentioned below:
cd /usr/bin
ls -l |grep ja
lrwxrwxrwx 1 root root 25 Jul 31 11:33 jar -> /usr/java/default/bin/jar
lrwxrwxrwx 1 root root 34 Jul 31 12:00 java -> /usr/java/java-1.4/jre/bin/java
lrwxrwxrwx 1 root root 27 Jul 31 11:33 javac -> /usr/java/default/bin/javac
lrwxrwxrwx 1 root root 29 Jul 31 11:33 javadoc -> /usr/java/default/bin/javadoc
lrwxrwxrwx 1 root root 28 Jul 31 11:33 javaws -> /usr/java/default/bin/javaws
lrwxrwxrwx 1 root root 30 Jul 31 11:33 jcontrol -> /usr/java/default/bin/jcontrol
So here you can see all the java components are pointing to /usr/java/default but the "java" component is pointing to java-1.4 :
ls -l /usr/java/default
/usr/java/default -> /usr/java/jdk1.6.0_26
So, all the components are pointing to the latest version of JDK installed except : java
So when I check : which java
/usr/bin/java
java -version
java 1.4
So , I have to change the "java" executable to point to the latest version that is java-1.6_26 which is installed at location: /usr/java/jdk1.6.0_26
mv /usr/bin/java /usr/bin/java1.4
ln -s /usr/java/jdk1.6.0_26/jre/bin/java /usr/bin/java
Now check :
cd /usr/bin
ls -l |grep ja
lrwxrwxrwx 1 root root 25 Jul 31 11:33 jar -> /usr/java/default/bin/jar
lrwxrwxrwx 1 root root 34 Jul 31 12:00 java -> /usr/java/jdk1.6.0_26/jre/bin/java
lrwxrwxrwx 1 root root 22 Jun 20 15:39 java1.4 -> /usr/java/java-1.4/jre/bin/java
lrwxrwxrwx 1 root root 27 Jul 31 11:33 javac -> /usr/java/default/bin/javac
lrwxrwxrwx 1 root root 29 Jul 31 11:33 javadoc -> /usr/java/default/bin/javadoc
lrwxrwxrwx 1 root root 28 Jul 31 11:33 javaws -> /usr/java/default/bin/javaws
lrwxrwxrwx 1 root root 30 Jul 31 11:33 jcontrol -> /usr/java/default/bin/jcontrol
1 comment:
Very nicely done, I did edit what you posted and saved it in a txt file if I ever need it again. Here's what I have (newbie version).
# if the below directory doesn't exist, execute command below
mkdir ~/.mozilla/plugins
# firefox plugin folder *FOR ALL USERS*: /usr/lib/mozilla/plugins
# Download the latest ("Oracle", preferably) Java JRE .tar.gz file.
# *NOTE*: Replace ALL "X" with the most current Java version you download.
# Move "jre-XuXX-linux-x64.tar.gz" to "/usr/lib/jvm".
cd /usr/lib/jvm
tar -xf jre-XuXX-linux-x64.tar.gz
# only run below command if you don't have a "javaX.X" file in "/usr/bin"
sudo mkdir /usr/bin/javaX.X
sudo mv /usr/bin/java /usr/bin/javaX.X
sudo mv /usr/bin/javaws /usr/bin/javaX.X
sudo ln -s /usr/lib/jvm/jreX.X.X/bin/java /usr/bin/java
sudo ln -s /usr/lib/jvm/jreX.X.X/bin/javaws /usr/bin/javaws
# Now, check if you did everything correctly by inputting commands below.
cd /usr/bin
ls -l |grep ja
java -version
#To upgrade to new version of Java, repeat the same steps.
Post a Comment