set java home code example
Example 1: export java home
export JAVA_HOME_BIN=`which java`
export JAVA_HOME_DIR=`dirname $JAVA_HOME_BIN`
export JAVA_HOME=`dirname $JAVA_HOME_DIR`
Example 2: set java home path
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
# Add JAVA bin directory to the PATH variable
export PATH=$PATH:$JAVA_HOME/bin
Example 3: setting java home
1. Add a JAVA_HOME variable equal to something like: C:\Java\JDK1.7.0_25_x64
2. Add %JAVA_HOME%\bin to the beginning of your PATH variable.