How do I find the JDK installation path on a Linux server? Are there ways to find the installation path for locating the JDK? Are there some limitations? Here's a summary of how to find the JDK installation path.
1:echo $JAVA _home
If you use $java_home, you can locate the installation path of the JDK as long as the environment variable $java_home is configured, otherwise the installation path of the JDK is not located at all.
[Email protected] ~]# java-version
Java Version "1.7.0_65"
OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17)
OpenJDK 64-bit Server VM (build 24.65-b04, Mixed mode)
[Email protected] ~]# echo $JAVA _home
2:which Java
First of all, make a statement that which Java is not located in the installation path. Which Java navigates to the execution path of the Java program. The information on the Internet is the same, not to think at all. So how do you navigate to the Java installation path? Let's take a look at the example below, as shown below:
[Email protected] ~]# java-version
Java Version "1.7.0_65"
OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17)
OpenJDK 64-bit Server VM (build 24.65-b04, Mixed mode)
[email protected] ~]# which Java
/usr/bin/java
[Email protected] ~]# Ls-lrt/usr/bin/java
lrwxrwxrwx. 1 root root 15:12/usr/bin/java-/etc/alternatives/java
[Email protected] ~]# Ls-lrt/etc/alternatives/java
lrwxrwxrwx. 1 root root 15:12/etc/alternatives/java/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
[Email protected] ~]#
[Email protected] ~]# CD/USR/LIB/JVM
[[email protected] jvm]# ls
java-1.6.0-openjdk-1.6.0.0.x86_64 java-1.7.0-openjdk-1.7.0.65.x86_64 JRE jre-1.6.0 jre-1.6.0-openjdk.x86_64 jre-1.7.0 jre-1.7.0-openjdk.x86_64 JRE-OPENJDK
[Email protected] jvm]#
The same is true of Whereis Java, which itself cannot navigate to the installation path. You can use the example above to locate the installation path
3:RPM-QL PackageName
If the JDK is installed in the source code, then this method is not feasible. That is to say RPM–QL PackageName also has certain limitation.
[Email protected] ~]# java-version
Java Version "1.7.0_65"
OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17)
OpenJDK 64-bit Server VM (build 24.65-b04, Mixed mode)
[Email protected] ~]# Rpm-qa | grep java
Tzdata-java-2014g-1.el6.noarch
Java-1.6.0-openjdk-1.6.0.0-11.1.13.4.el6.x86_64
Java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el6_5.x86_64
[Email protected] ~]# RPM-QL java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el6_5.x86_64 | More
/etc/.java
/etc/.java/.systemprefs
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jaas-1.7.0.65.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jaas-1.7.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jaas.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jce-1.7.0.65.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jce-1.7.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jce.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jdbc-stdext-1.7.0.65.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jdbc-stdext-1.7.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jdbc-stdext-3.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jdbc-stdext.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-1.7.0.65.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-1.7.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-cos-1.7.0.65.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-cos-1.7.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-cos.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-ldap-1.7.0.65.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-ldap-1.7.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-ldap.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-rmi-1.7.0.65.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-rmi-1.7.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi-rmi.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jndi.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jsse-1.7.0.65.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jsse-1.7.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/jsse.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/sasl-1.7.0.65.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/sasl-1.7.0.jar
/usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.65.x86_64/sasl.jar
/usr/lib/jvm-exports/jre-1.7.0-openjdk.x86_64
/usr/lib/jvm-private/java-1.7.0-openjdk.x86_64
/usr/lib/jvm-private/java-1.7.0-openjdk.x86_64/jce
/usr/lib/jvm-private/java-1.7.0-openjdk.x86_64/jce/vanilla
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/assembly_exception
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/license
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/third_party_readme
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin/keytool
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin/orbd
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin/pack200
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin/policytool
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin/rmid
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65.x86_64/jre/bin/rmiregistry
--more--
CentOS Build JDK Environment http://www.linuxidc.com/Linux/2015-06/118879.htm
Ubuntu 14.04 installation jdk1.8.0_25 with configuration environment variables http://www.linuxidc.com/Linux/2015-01/112030.htm
Ubuntu 14.04 LTS installs Oracle JDK 1.8 http://www.linuxidc.com/Linux/2014-11/109216.htm
CentOS6.3 Installing the JDK and environment configuration http://www.linuxidc.com/Linux/2012-09/70780.htm
Ubuntu 14.04 Installation JDK8 http://www.linuxidc.com/Linux/2014-09/106218.htm
Ubuntu installation JDK graphic parsing http://www.linuxidc.com/Linux/2014-09/107291.htm
This article permanently updates the link address : http://www.linuxidc.com/Linux/2015-08/122353.htm
How Linux looks at the installation path of the JDK--go