NOTE: If you encounter the error “Unsupported major.minor version error”,
you must remove the other Java version and all references to it using the
following commands:
- Update your repository first: sudo apt-get update
- Remove all Oracle and/or Java
related files: sudo apt-cache search java | awk 'print($1)'
| grep -E -e '^(ia32-)?(sun|oracle)-java' -e
'^openjdk-' -e '^icedtea' -e
'^(default|gcj)-j(re|dk)' -e 'ĝcj-(.⋆)-j(re|dk)' -e
'java-common' | xargs sudo apt-get -y remove
- sudo apt-get -y autoremove
- Purge all config files: dpkg -l | grep ^rc | awk 'print($2)' |
xargs sudo apt-get -y purge
- Remove Java config and cache directory: sudo bash -c 'ls -d
/home/⋆/.java' | xargs sudo rm -rf
- Remove manually installed Java Virtual Machines (JVM): sudo rm -rf
/usr/lib/jvm/⋆