Check out example codes for "export java home". It will help you in understanding the concepts better.

Code Example 1

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

# Add JAVA bin directory to the PATH variable
export PATH=$PATH:$JAVA_HOME/bin

Code Example 2

export JAVA_HOME_BIN=`which java`
export JAVA_HOME_DIR=`dirname $JAVA_HOME_BIN`
export JAVA_HOME=`dirname $JAVA_HOME_DIR`

Learn ReactJs, React Native from akashmittal.com