但是我安装了java了哈
PHP中文网2017-04-18 10:53:00
Make sure your JAVA_HOME is in the system environment variable. Just being in the bash environment variable may not work.
You can edit the /etc/environment file and add the JAVA_HOME variable to point to the location of your JDK installation instead of the location of the JRE, and then restart the system :P
Look at my JAVA_HOME, the folder pointed to is "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.121-2.6.8.0.el7_3.x86_64", but this folder Downloaded only by jre. And I can also execute java commands, but this java command has nothing to do with my JAVA_HOME settings. It points to the directory of openjdk8 "/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13 .el7_3.x86_64/”.
That is to say, being able to execute java commands does not mean that the JAVA_HOME setting is correct.
伊谢尔伦2017-04-18 10:53:00
Don’t only configure the environment variables JAVA_HOME, but also CLASSPATH
For example:
export JAVA_HOME=/lib/jdk1.8.0_60
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH