method one
The java_home environment is not configured
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
(Note that amd64 cannot be followed by /, 11 can be replaced with its corresponding version)
export PATH=$PATH:$JAVA_HOME/bin
Method Two
Find your own/etc/profile file, configure the java_home environment in this file, and write the above two lines of code into the file to completely solve the problem of environment variables.
Finally, restart and source /etc/profile