java home not set_Error: JAVA_HOME is not set and could not be found.

Error: JAVA_HOME is not set and could not be found.

问题:

Centos7 安装CDH时报错:Error: JAVA_HOME is not set and could not be found.

+ local name=log4j.properties

+ '[' '!' -f /opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-agent/process/ccdeploy_spark-conf_etcsparkconf.cloudera.spark_on_yarn_6447222260596468198/spark-conf/yarn-conf/log4j.properties ']'

+ mv /opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-agent/process/ccdeploy_spark-conf_etcsparkconf.cloudera.spark_on_yarn_6447222260596468198/hbase-conf/log4j.properties /opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-agent/process/ccdeploy_spark-conf_etcsparkconf.cloudera.spark_on_yarn_6447222260596468198/spark-conf/yarn-conf

+ for i in '"$HBASE_CONF_DIR"/*'

++ basename /opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-agent/process/ccdeploy_spark-conf_etcsparkconf.cloudera.spark_on_yarn_6447222260596468198/hbase-conf/ssl-client.xml

+ local name=ssl-client.xml

+ '[' '!' -f /opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-agent/process/ccdeploy_spark-conf_etcsparkconf.cloudera.spark_on_yarn_6447222260596468198/spark-conf/yarn-conf/ssl-client.xml ']'

++ get_default_fs /opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-agent/process/ccdeploy_spark-conf_etcsparkconf.cloudera.spark_on_yarn_6447222260596468198/spark-conf/yarn-conf

++ get_hadoop_conf /opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-agent/process/ccdeploy_spark-conf_etcsparkconf.cloudera.spark_on_yarn_6447222260596468198/spark-conf/yarn-conf fs.defaultFS

++ local conf=/opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-agent/process/ccdeploy_spark-conf_etcsparkconf.cloudera.spark_on_yarn_6447222260596468198/spark-conf/yarn-conf

++ local key=fs.defaultFS

++ '[' 1 == 1 ']'

++ /opt/cloudera/parcels/CDH-5.14.4-1.cdh5.14.4.p0.3/lib/hadoop/../../bin/hdfs --config /opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-agent/process/ccdeploy_spark-conf_etcsparkconf.cloudera.spark_on_yarn_6447222260596468198/spark-conf/yarn-conf getconf -confKey fs.defaultFS

Error: JAVA_HOME is not set and could not be found.

+ DEFAULT_FS=

解决方法

使用rpm 安装jdk

下载jdk-8u201-linux-x64.rpm

chmod 755 jdk-8u201-linux-x64.rpm

rpm -i jdk-8u201-linux-x64.rpm

配置环境变量:

export JAVA_HOME=/usr/java/jdk1.8.0_201-amd64

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar

export PATH=$PATH:$JAVA_HOME/bin

你可能感兴趣的:(java,home,not,set)