Rumah > Artikel > Operasi dan penyelenggaraan > Bagaimana untuk menyemak laluan pemasangan jdk dalam linux
Cara menyemak laluan pemasangan jdk di Linux: 1. Gunakan arahan "echo $JAVA_HOME" untuk mendapatkan laluan jdk dikonfigurasikan oleh pembolehubah persekitaran "$JAVA_HOME" 2. Gunakan "rpm -qa | grep java", Lihat laluan pemasangan jdk dengan mendapatkan laluan ke pakej pemasangan.
Persekitaran pengendalian tutorial ini: sistem linux5.9.8, komputer Dell G3.
Pandangan Linux laluan pemasangan jdk
Kaedah 1: Gunakan echo $JAVA_HOME
Gunakan $JAVA_HOME
Prasyarat untuk mencari laluan pemasangan JDK adalah untuk mengkonfigurasi pembolehubah persekitaran $JAVA_HOME Jika tidak, seperti yang ditunjukkan di bawah, laluan pemasangan JDK tidak boleh ditemui sama sekali
[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<.>
Kaedah 2: Gunakan rpm -qa | grep java<br>
juga mempunyai had tertentu. rpm –ql packagename
[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 -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--
Pengetahuan lanjutan:
java -version
[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)
which java
[root@localhost ~]# which java /usr/bin/java [root@localhost ~]# ls -lrt /usr/bin/java lrwxrwxrwx. 1 root root 22 Aug 17 15:12 /usr/bin/java -> /etc/alternatives/java [root@localhost ~]# ls -lrt /etc/alternatives/java lrwxrwxrwx. 1 root root 46 Aug 17 15:12 /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]#
Perkara yang sama berlaku, ia tidak dapat mengesan laluan pemasangan itu sendiri. Anda boleh menggunakan contoh di atas untuk mencari laluan pemasanganwhereis java
Tutorial Video Linux"
Atas ialah kandungan terperinci Bagaimana untuk menyemak laluan pemasangan jdk dalam linux. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!