The reason it didn't work with export$JAVA_HOME
exports ais that $JAVA_HOME
isn't the same thing as $JAVA_HOME/bin
. Your binaries (java
, javac
, javaws
, etc) are all found in the bin
directory inside your $JAVA_HOME
, not in the $JAVA_HOME
itself.
The working line in your question points towards /usr/java/jre1.8.0_51/bin
; the JAVA_HOME
variable points towards /usr/java/latest
, but you still havewhich is a symlink to set it/usr/java/jre1.8.0_51
. Either doThat's clearly not the same place.
If you use
export PATH=$PATHPATH="$PATH:$extra$JAVA_HOME/bin"
or doit will work.
PATH=$PATH:$extra
export $PATH