Downloading the binary
First thing first, please download the Oracle Java binary from Oracle's website. If you want to develop Java application, you should choose JDK, but if you want just run Java application, the JRE should be suitable for you.
Once the download button clicked, you will be offered with many choices of download. Please download the suitable version for your system architecture, and please make sure you select file which has *.tar.gz extension.
Installing on Ubuntu
Once the binary file downloaded, simply run the following command to install Oracle Java on Ubuntu:
It's easy, isn't is? :D
- sudo tar -zxvf jdk-7u7-linux-i586.tar.gz -C /usr/lib/jvm/
Configuring default Java on Ubuntu
Once Oracle Java has been installed, you need to tell the system that you've just installed a new Java, and optionally make it as a default JVM on Ubuntu:
Optionally, run the following command to choose the default Java on Ubuntu:
- for alt in java javac; do sudo update-alternatives --install /usr/bin/$alt $alt /usr/lib/jvm/jdk*/bin/$alt 1000; done
Check if the Oracle Java is set as default Java by typing:
- for alt in java javac; do sudo update-alternatives --config $alt; done
- java -version
Uninstalling
In case, you are disappointed with Oracle Java and want to remove it (switch back to OpenJDK). Simply run the following command:
via: Xubuntu Geek
- sudo update-alternatives --config java
- #choose OpenJDK
- sudo update-alternatives --config javac
- #choose OpenJDK
- sudo rm -rf /usr/lib/jvm/jdk1.7.0_07/
- #It will remove the Oracle Java on Ubuntu
0 comments:
Post a Comment