Set environment variables as follows for Linux user sudo is important don't forget to use sudo.
Step 1: sudo su
Step 2: which jvm
If you have java installed in your machine then you will get the following result:
jvm: /usr/lib/jvm
then ls for residing files.
Find the path of Java
Step 3: gedit /etc/profile or you can use nano as editor
OR
Step 4: gedit /etc/environment or you can usenano as editor
Step 5. JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/bin/"
Step 6. source /etc/environment
work in progress