Contents
How do I remove old Java version from Linux?
- purge the older with sudo apt-get purge openjdk-*
- Add repository sudo add-apt-repository ppa:openjdk-r/ppa.
- Update the packages sudo apt-get update.
- Install java 8 with sudo apt-get install openjdk-8-jdk.
- To check list of java versions installed do sudo update-java-alternatives –list.
How do I change Java alternatives in Linux?
To set the Java version interactively:
- Log in as root or use sudo .
- View the Java alternatives. sudo update-alternatives –config java. …
- Select a Java version, at the prompt, type a number. Press enter to keep the default[*], or type selection number: …
- Verify the switch, check the Java version. java -version.