What you want to do is to install Java 8 in $HOME
rather than in /usr
. This is always a good practice because, if you mess up, you can just rm -rf ~/.local
, and it's no-harm/no-foul on the box. On the other hand, if you mess up inside /usr
or equivalent, then you have a whole different set of issues.
Please specify which OS you're on (I guess it's either Ubuntu or CentOS.) In the former case, download the .deb package for Java 8 and follow this guide to installing it in $HOME
. After that, you can set an environment variable to set your default Java to that one locally within that environment, but not globally.
https://askubuntu.com/questions/339/how-can-i-install-a-package-without-root-access
If you're on CentOS, the best move would be to download the source and build it with autotools (same procedure - just don't use yum
.)
I am using rhel fedora – nag – 2019-06-17T12:03:58.163
Then just download from source; that should be fine. – Hari Amoor – 2019-06-24T09:25:48.317