# java -version
-bash: java: command not found
我在 usr/local
中有 jdk1.8.0_40
这个文件夹。
当我导航到该文件夹并键入 alternatives --config jar
时,我得到了这样的输出
There is 1 program that provides 'jar'.
Selection Command
-----------------------------------------------
*+ 1 /opt/jdk1.8.0_40//bin/jar
Enter to keep the current selection[+], or type selection number:
这些是jdk中的内容
bin include lib README.html THIRDPARTYLICENSEREADME-JAVAFX.txt
COPYRIGHT javafx-src.zip LICENSE release THIRDPARTYLICENSEREADME.txt
db jre man src.zip
最佳答案
您需要将安装路径添加到 PATH 变量中。 Bash 仅在您的 PATH 变量定义的路径中查找可执行文件。
关于java - -bash : java: command not found in Centos5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45372651/