Get the source file from Oracle.Since I used JDK 7, I visited this page and downloaded jdk-7u10-linux-i586.tar.gz (for Linux x86).
Extract it somewhere
curl -J -O -C - http://download.oracle.com/otn-pub/java/jdk/7u10-b18/jdk-7u10-linux-i586.tar.gz?AuthParam=1355492655_c33bc95a6d13e7345ba318a0b46bcc4a mv jdk-7u10-linux-i586.tar.gz?AuthParam=1355492655_c33bc95a6d13e7345ba318a0b46bcc4a jdk-7u10-linux-i586.tar.gz tar -xvvf jdk-7u10-linux-i586.tar.gz
Perform the installation:
sudo mv ./jdk1.7.0_10 /usr/lib/jvm/jdk1.7.0 sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
Now choose the correct version of the programs if you have more than installed (as is most likely the case as the OS often comes with a version, and you install another). This is to avoid the error message that states that the version of java and javac clash (or something similiar).
sudo update-alternatives --config java sudo update-alternatives --config javac sudo update-alternatives --config javaws
[[email protected] droidzone]# sudo update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/bin/gij-4.4 1044 auto mode 1 /usr/bin/gij-4.4 1044 manual mode * 2 /usr/lib/jvm/jdk1.7.0/bin/java 1 manual mode Press enter to keep the current choice[*], or type selection number:
As noted, I’ve chosen the version I just installed, which is jdk1.7.0.
Depending on the versions you have installed, you may need to repeat similiarly for:
[[email protected] droidzone]# sudo update-alternatives --config javac There is only one alternative in link group javac: /usr/lib/jvm/jdk1.7.0/bin/javac Nothing to configure.
And:
[[email protected] droidzone]# sudo update-alternatives --config javaws There is only one alternative in link group javaws: /usr/lib/jvm/jdk1.7.0/bin/javaws Nothing to configure.
You will notice that since I had only single versions of javac and javaws, I didnt need to choose another one. It may just be worthwhile to try these commands anyway.
Confirm that the version of java and javac correspond:
[[email protected] droidzone]# `which java` -version java version "1.7.0_10" Java(TM) SE Runtime Environment (build 1.7.0_10-b18) Java HotSpot(TM) Server VM (build 23.6-b04, mixed mode) [[email protected] droidzone]# `which javac` -version javac 1.7.0_10 [[email protected] droidzone]#
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.