centos自带的java,可以直接运行java, 但不知道是怎么访问到的,所以就查了一下
[root@aaa]# java -version openjdk version "1.8.0_262" OpenJDK Runtime Environment (build 1.8.0_262-b10) OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
查看版本号,可以看到能访问java
[root@aaa /]# cat /etc/profile
查看配置文件,也没看到相关的环境变量配置
[root@aaa /]# echo $JAVA_HOME
查看环境变量,也没有值
[root@aaa /]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
查看系统配置的默认路径
[root@aaa /]# cd /usr/bin
[root@aaa bin]# ll java*
lrwxrwxrwx. 1 root root 22 Oct 12 2021 java -> /etc/alternatives/java lrwxrwxrwx. 1 root root 24 Oct 12 2021 javaws -> /etc/alternatives/javaws -rwxr-xr-x. 1 root root 5530 Apr 4 2020 javaws.itweb
在/usr/bin/下,查到java,是一个链接
[root@aaa /]# cd /etc/alternatives [root@aaa alternatives]# ll java* lrwxrwxrwx. 1 root root 71 Oct 12 2021 java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64/jre/bin/java lrwxrwxrwx. 1 root root 75 Oct 12 2021 java.1.gz -> /usr/share/man/man1/java-java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64.1.gz lrwxrwxrwx. 1 root root 21 Oct 12 2021 javaws -> /usr/bin/javaws.itweb lrwxrwxrwx. 1 root root 37 Oct 12 2021 javaws.1.gz -> /usr/share/man/man1/javaws.itweb.1.gz
这个链接是指向 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64/jre/bin/java
[root@aaa alternatives]# cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64/jre/bin/ [root@aaa bin]# ll total 252 -rwxr-xr-x. 1 root root 9032 Oct 2 2020 alt-java -rwxr-xr-x. 1 root root 9024 Oct 2 2020 java -rwxr-xr-x. 1 root root 9160 Oct 2 2020 jjs -rwxr-xr-x. 1 root root 9160 Oct 2 2020 keytool -rwxr-xr-x. 1 root root 9216 Oct 2 2020 orbd -rwxr-xr-x. 1 root root 9160 Oct 2 2020 pack200 -rwxr-xr-x. 1 root root 9168 Oct 2 2020 policytool -rwxr-xr-x. 1 root root 9160 Oct 2 2020 rmid -rwxr-xr-x. 1 root root 9168 Oct 2 2020 rmiregistry -rwxr-xr-x. 1 root root 9168 Oct 2 2020 servertool -rwxr-xr-x. 1 root root 9216 Oct 2 2020 tnameserv -rwxr-xr-x. 1 root root 122232 Oct 2 2020 unpack200
[root@aaa bin]# ./java -version openjdk version "1.8.0_262" OpenJDK Runtime Environment (build 1.8.0_262-b10) OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode) [root@aaa bin]#
标签:bin,java,centos,2020,xr,自带,root,Oct From: https://www.cnblogs.com/bianguji/p/17719270.html