• 【错误记录】安装 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

    在这里插入图片描述

  • 相关阅读:
    人大金仓数据库,可以外连SQL Server 、MySql 数据库吗?
    vue2双向绑定原理:深入响应式原理defineProperty、watcher、get、set
    Power BI - 在列表中点击详情按钮跳转到详情页面并传递参数
    Settings应用详情页面 & 安卓应用安装器 - com.google.android.packageinstaller
    __proto__和protype的区别
    学习 go-admin 框架(1)
    开发工具篇第九讲:菜鸟入坑指南
    Spring boot+Spring security+JWT实现前后端分离登录认证及权限控制
    java经典笔试题大全(50道含答案)
    互联网摸鱼日报(2022-12-03)
  • 原文地址:https://blog.csdn.net/han1202012/article/details/132081767