Oct 23, 2020
I faced the same Issue, one better solution which helped me when all above 3 methods didn't work and I was about to reinstall ubuntu...
I went into system path in /etc/environment and removed the recent changed paths for java or maven then saved it with root access and reboot system.
This works for me, hope it will help someone!!