How to view the JDK installation path in Linux

Source: Internet
Author: User
Tags ldap

How to view the JDK installation path in Linux

On a Linux server, how does one find the JDK installation path? Which of the following methods can be used to find the JDK installation path? Are there some limitations? The following describes how to find the JDK installation path.

1: echo $ JAVA_HOME

If you use $ JAVA_HOME, you must configure the environment variable $ JAVA_HOME to locate the JDK installation path. Otherwise, the JDK installation path cannot be found as follows.

[Root @ localhost ~] # 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)

[Root @ localhost ~] # Echo $ JAVA_HOME

2: which java

First, declare that which java cannot find the installation path. Which java locates the java program execution path. The materials on the Internet are all cloud-based, so you don't have to think about them. So how to locate the installation path of java? Let's take a look at the example below:

[Root @ localhost ~] # 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)
 
[Root @ localhost ~] # Which java
 
/Usr/bin/java
 
[Root @ localhost ~] # Ls-lrt/usr/bin/java
 
Lrwxrwxrwx. 1 root 22 Aug 17 15:12/usr/bin/java->/etc/alternatives/java
 
[Root @ localhost ~] # Ls-lrt/etc/alternatives/java
 
Lrwxrwxrwx. 1 root 46 Aug 17/etc/alternatives/java->/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
 
[Root @ localhost ~] #
 
[Root @ localhost ~] # Cd/usr/lib/jvm
 
[Root @ localhost 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
 
[Root @ localhost jvm] #

The same is true for whereis java, which cannot locate the installation path. You can use the above example to locate the installation path

3: rpm-ql packagename

If JDK is installed in the source code, this method will not work. That is to say, rpm-ql packagename also has some limitations.

[Root @ localhost ~] # 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)
[Root @ localhost ~] # 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
[Root @ localhost ~] # Rpm-SQL 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/The 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/yytool
/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 --

Build a JDK environment using CentOS

Install JDK 1.8.0 _ 25 on Ubuntu 14.04 and configure Environment Variables

Install Oracle JDK 14.04 on Ubuntu 1.8 LTS

CentOS6.3 install JDK and environment Configuration

Install JDK 8 on Ubuntu 14.04

Install JDK graph analysis in Ubuntu

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.