jdk1.7.0.rpm package in RHEL6.
Where I do find the path to execute my first java program?
Try either of the two:
$ which java
$ whereis java
For your first java program read this tutorial:
You can list the installed files with
rpm -ql packagename
You will see somewhere a
bin directory with
But if the JDK RPM was correctly installed you should already find
java in you path.
and if everything compiles
(If you didn't change anything the current directory
. should already be in your class path)
-q is short for --query -l is short for --list
rpm -ql jdk1.8.0_20 | grep "jdk1.8.0_20/bin$"
Knowing this may be desirable for setting a user or application's
$JAVA_HOME variable. This is often needed when a system has multiple versions of java installed, or multiple distributions of java installed, such as OpenJDK and Oracle/Sun.
~/.bash_profile, or related file (
setenv.sh), something similar to the below may be used.
JAVA_HOME='/usr/java/jdk1.8.0_20' export JAVA_HOME PATH="$JAVA_HOME/bin:$PATH" export PATH
If you would like more control over where Java gets installed, such as in
/opt, then the tarball can be used instead of the RPM file.
Other similar questions, are asking about how to find any binary or file, in the general case.
On RHEL7, I used
and it led me to the
/usr/lib/jvm/ directory which contained the directories:
java-1.8.0-openjdk-18.104.22.168-0.b14.el7_4.x86_64/ jre/ jre-1.8.0/ jre-1.8.0-openjdk/ jre-1.8.0-openjdk-22.214.171.124-0.b14.el7_4.x86_64/ jre-openjdk/
Each of these contain a
To find the full path of the symbolic link use:
readlink -f $(which java)
*Credit: Answer on Stack Overflow
**Note: I'm answering here as it was the first result in Google
protected by Community♦ May 16 '18 at 7:10
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?