Ubuntu switch to root user cannot find the environment variable PATH problem
The command usually used to switch ubuntu to the root user is:
su root
su
It is to switch user access rights, but the environment variable is not obtained;
therefore, the PATH environment variable cannot be found under the root user, and Java cannot be found.
There is also a way to switch users
su - root
su -
It is a complete switch user, you can get environment variables, so you can find Java.