You can download the version you want for the architecture you need from Oracles web site. by the time of this post the version I used was jdk-6u33 but it should apply to any version.
JDK Download |
chmod +x jdk-6u33-linux-i586.bin ./jdk-6u33-linux-i586.binYou will see a jdk-6u33-linux-i586 folder as result of the last
Third step is to move the folder to a safe and standard place. To do that we use the next command
sudo mv jdk-6u33-linux-i586 /usr/lib/jvm/Next we create a symbolic link, you know so you do not have to type jdk-6u33-linux-i586 all the time. We do that by typing
cd /usr/lib/jvm/ sudo ln -s jdk-6u33-linux-i586 javaFinally, you need to set the environment variables. In my case update them since I already had openjdk installed but it will work either you have or not another version installed before. You need to do it for both java and javac
sudo update-alternatives --config javac sudo update-alternatives --config java
Default jdk |
To test this out you just type
java -version javac -version
checking versions |
There is an easy way to this which is adding an extra repository. There are tons of PPAs that come with Oracle-SUN JDK these days, but as you know I like to have control of these things. The easy way is like this
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java6-installerMore information and nice guides can be found here, here and here.
Let me know if you have any questions.
Happy coding!
should be
ReplyDeletesudo add-apt-repository ppa:webupd8team/java
not
sudo add-apt-repository ppa:webup8team/java