I'm trying to install eclipse on xubuntu, I installed java with
sudo gdebi <java-package>.deb, I added it to the
/etc/environment to both
PATH and "JAVA_HOME" then reloaded the environment and also rebooted the whole system.
java --version I got the correct output
java 12.0.1 2019-04-16 Java(TM) SE Runtime Environment (build 12.0.1+12) Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
both if called by superuser
$ sudo su # java --version
$ java --version
$ sudo java --version
java: command not found
sudo echo $PATH
and path to java is present:
How can I fix it? also could someone explain my why this happens?