• 【错误记录】安装 Hadoop 运行环境报错 ( Error: JAVA_HOME is incorrectly set. Please update xxx\hadoop-env.cmd )



    总结 :

    报错 : Error: JAVA_HOME is incorrectly set. Please update xxx\hadoop-env.cmd

    JDK 安装在了 C:\Program Files\ 目录下 , 安装目录 Program Files 有空格 , 太坑了 ;

    换一个没有空格的 JDK 目录 ;





    一、报错信息



    安装 Hadoop 运行环境 ,

    完成上述安装步骤后 , 运行 hadoop 命令报错 ;


    C:\Windows\system32>hadoop -version
    The system cannot find the path specified.
    Error: JAVA_HOME is incorrectly set.
         Please update D:\001_Develop\052_Hadoop\hadoop-3.3.4\etc\hadoop\hadoop-env.cmd
    ‘-Xmx512m’ is not recognized as an internal or external command,
    operable program or batch file.


    报错信息如下 :

    C:\Windows\system32>hadoop -version
    The system cannot find the path specified.
    Error: JAVA_HOME is incorrectly set.
           Please update D:\001_Develop\052_Hadoop\hadoop-3.3.4\etc\hadoop\hadoop-env.cmd
    '-Xmx512m' is not recognized as an internal or external command,
    operable program or batch file.
    
    C:\Windows\system32>hadoop -version
    The system cannot find the path specified.
    Error: JAVA_HOME is incorrectly set.
           Please update D:\001_Develop\052_Hadoop\hadoop-3.3.4\etc\hadoop\hadoop-env.cmd
    '-Xmx512m' is not recognized as an internal or external command,
    operable program or batch file.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    在这里插入图片描述





    二、问题分析



    核心报错信息 :

    Error: JAVA_HOME is incorrectly set.
         Please update D:\001_Develop\052_Hadoop\hadoop-3.3.4\etc\hadoop\hadoop-env.cmd

    那就是 在 D:\001_Develop\052_Hadoop\hadoop-3.3.4\etc\hadoop\hadoop-env.cmd 文件中的 JAVA_HOME 设置错误 ;

    设置内容如下 :

    set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_91
    
    • 1

    在这里插入图片描述

    问题就是出在这个路径上 , 这个路径是 JDK 的实际路径 ;

    但是路径中出现一个空格 , 这就导致了运行 Hadoop 报错 ;





    三、解决方案



    换一个没有空格的 JDK :

    set JAVA_HOME=D:\001_Develop\031_Java8u144_Frida\jdk1.8.0_144
    
    • 1

    在这里插入图片描述

    再次运行

    hadoop -version
    
    • 1

    命令 , 此时 Hadoop 运行成功 ;

    C:\Windows\system32>hadoop -version
    java version "1.8.0_144"
    Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
    Java HotSpot(TM) Client VM (build 25.144-b01, mixed mode)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5

    在这里插入图片描述

    运行

    hadoop
    
    • 1

    命令 , 可以正确运行 ;

    C:\Windows\system32>hadoop
    Usage: hadoop [--config confdir] [--loglevel loglevel] COMMAND
    where COMMAND is one of:
      fs                   run a generic filesystem user client
      version              print the version
      jar <jar>            run a jar file
                           note: please use "yarn jar" to launch
                                 YARN applications, not this command.
      checknative [-a|-h]  check native hadoop and compression libraries availability
      conftest             validate configuration XML files
      distch path:owner:group:permisson
                           distributed metadata changer
      distcp <srcurl> <desturl> copy file or directories recursively
      archive -archiveName NAME -p <parent path> <src>* <dest> create a hadoop archive
      classpath            prints the class path needed to get the
                           Hadoop jar and the required libraries
      credential           interact with credential providers
      jnipath              prints the java.library.path
      kerbname             show auth_to_local principal conversion
      kdiag                diagnose kerberos problems
      key                  manage keys via the KeyProvider
      trace                view and modify Hadoop tracing settings
      daemonlog            get/set the log level for each daemon
     or
      CLASSNAME            run the class named CLASSNAME
    
    Most commands print help when invoked w/o parameters.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27

    在这里插入图片描述

  • 相关阅读:
    WIZnet 物联网设计大赛 - WizFi360大赛延迟通知
    黑马点评项目遇到的部分问题
    前置知识--Quartz
    DBCO-PEG-carboxyl COOH-PEG-DBCO 二苯并环辛炔-聚乙二醇-羧酸 羧酸修饰PEG二苯并环辛炔
    爬虫项目(下)
    如何用Redis实现分布式锁?
    如何理解进程的 no_new_privs 属性?
    js-函数式编程-部分应用柯里化-partial和compose-条件和结果、结果和结果
    图详解第四篇:单源最短路径--Dijkstra算法
    jQuery类库
  • 原文地址:https://blog.csdn.net/han1202012/article/details/132081767