How to set JAVA_HOME on Linux

We can set JAVA_HOME on Linux in different ways. One of the prominent ways is to set the JAVA_HOME using