Well, simply run the following command to install Oracle Java 8 on Ubuntu:
Please wait for a while because it needs to download Oracle Java 8 from the official website.
- sudo add-apt-repository ppa:webupd8team/java
- sudo apt-get update
- sudo apt-get install oracle-java8-installer
Once installed, please make sure that Oracle Java 8 works properly and made default by the installer. Run "java -version" on Terminal.
If you see the output like the picture above, it means Oracle Java 8 is installed correctly.
Changing default Java
If you have two or more Java on your system, you can switch the default Java by running the following command:
- sudo update-alternatives --config java
Now, please type the corresponding number of Java you want to use. In this example, I want to switch to OpenJDK as default Java, so I type "1" and then press "Enter".
So, when I type "java -version" on Terminal, it displays the version of OpenJDK instead of Oracle JDK 8.
Enjoy :)
via: WebUpd8
0 comments:
Post a Comment