I am trying to move the Java installation on an RHEL system. which java
currently returns /usr/java/latest/jre/bin/java
, and I want it to reference /usr/bin/java
. There appears to be a symbolic link java
at /usr/bin/java
, but frankly I'm not really sure how those work. Can I move the java
directory at /usr/java
somewhere? I need it to reference the aforementioned directory for my orchestration tools to work correctly; the JAVA_HOME
is actually what is throwing the error, but I figure that moving the java installation itself would be vital to that.
I was able to resolve this by first changing my init scripts as that other guy suggested (in this case, I removed some outdated stuff from my .bash_profile
and added /usr/bin
to the beginning of my PATH) and then creating new symbolic links in the /usr/bin
directory. This meant I needed to move the Java directory into the new JAVA_HOME
location, delete the old symlinks to java
and javac
(well, I just renamed them to have -old
prefixes just in case), and create new symlinks going to the new (desired) JAVA_HOME
from /usr/bin
, and I dynamically set the JAVA_HOME
using readlink
.