java - Find JAVA_HOME and set it on RHEL -
i had installed java while ago on rhel machine. now, i'm trying run program requires java_home variable set. best way figure out installation directory of java installation , set java_home? here results of running java- version :
java version "1.7.0_25" java(tm) se runtime environment (build 1.7.0_25-b15) java hotspot(tm) 64-bit server vm (build 23.25-b01, mixed mode)
i have /usr/lib/jvm directory, empty.
first, try echo $java_home
command line. since java
on path already, java_home
may set.
what best way figure out installation directory of java installation
running command which java
point java
installed.
and set java_home
you can edit ~/.bashrc
, ~/.bash_profile
, or /etc/profile
set java_home
. setting in ~/etc/profile
set system wide, , not want. sake of example output of which java
/opt/jdk_1.7.0_25
, you'd add export java_home=/opt/jdk_1.7.0_25
~/.bashrc
or ~/.bash_profile
, run source ~/.bashrc
(or source ~/.bash_profile
if set there).
note in case, java
on path
in cases you'd need add export path=$path:$java_home/bin
add java_home
variable path
.
Comments
Post a Comment