I have been allocated a Linux box in which has java available
# java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
# ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 22 Feb 8 2013 /usr/bin/java -> /etc/alternatives/java
I am new to Java and not sure if JRE is installed in ths box but based upon search:
# rpm -q jre
package jre is not installed
# find / -iname java -print 2>/dev/null
/usr/lib/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/bin/java
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java
/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/bin/java
/usr/bin/java
/usr/share/java
/var/lib/alternatives/java
/etc/alternatives/java
/etc/java
/etc/pki/java
But
# echo $JAVA_HOME
# echo $JRE_HOME
So is JAVA is installed and JRE also - am I correct but what value I should set for JAVA_HOME and JRE_HOME env variables?
I am not sure about any other version of Linux, but in Ubuntu you need open home/.bashrc and add in the end of file
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64
export PATH=$JAVA_HOME/bin:$PATH
after that, save file and relogin.
EDIT
java will know where is jre by JAVA_HOME.
firstly try to get out of root user if possible than after that change below in your ~/.bash_profile
JAVA_HOME=/usr/java/<Java version 7 jdk>; export JAVA_HOME // you can also try JAVA_HOME=/usr/java/jdk 7 version/bin/java
PATH=$JAVA_HOME/bin:$PATH; export PATH
save it and then
now source ~/.bashrc
after that try
echo $JAVA_HOME
it will produce the expected result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With