In some Linux distros, the vendor included OpenJDK as the default JVM, but sometime this not what you’re looking for. If you want to use Sun JDK instead, you can follow below instructions:
- Purge existing OpenJDK from your Ubuntu:
Java1sudo apt-get purge openjdk*
- Add a new repository and install Sun JDK:
Java1234sudo apt-get install python-software-propertiessudo add-apt-repository ppa:eugenesan/javasudo apt-get updatesudo apt-get install oracle-java7-installer
- If you want the JRE and the browser plugin:
Java1234sudo apt-get install python-software-propertiessudo add-apt-repository ppa:webupd8team/javasudo apt-get updatesudo apt-get install oracle-java7-installer
- You may want to also add the following:
Java1sudo update-alternatives --config java
If you have more than one JVMs in your machine, then you can choose which one you want to use as default JVM.
Then, you can execute this to check default JVM version:
Your newly installed Oracle JDK 7 will be printed out. It’s straight forward, right?