"Error: JAVA_HOME is incorrectly set" and "'-Xmx512m‘ is not recognized as an internal or external command, operable program or batch file" errors

When you encounter “Error: JAVA_HOME is incorrectly set” and “‘-Xmx512m’ is not recognized as an internal or external command, operable program or batch file” errors, you can follow the steps below to solve them:

  1. Move the Java JDK directory from C:\Program Files\Java to a directory without spaces, such as C:\Java.

  2. Open the system environment variable settings:

    • On Windows, right-click My Computer (or This PC), select Properties, and then click Advanced system settings.
    • In the window that opens, click the "Environment Variables" button.
  3. In the "System Variables" section, find the variable named JAVA_HOME.

    • Click the "Edit" button and update the variable value to the new Java JDK path, which is C:\Java\jdk-19.
  4. Confirm the changes and close all windows.

  5. Use command java -version to check whether Java is installed and configured correctly.

After confirming that Java is installed correctly, you can proceed with the following steps to troubleshoot Hadoop related issues:

  1. Make sure that the Hadoop installation directory and related files are correct, and that the Hadoop bin directory is included in the system's PATH environment variable.

  2. Run hadoop version command to check if Hadoop has been successfully installed and configured. There are two possible output results:

    • If Hadoop has been installed and configured correctly, the output will be similar to:

      `Hadoop 3.3.1`
      `Source code repository https://gitbox.apache.org/repos/asf/hadoop.git -r 12a5b2b9a7fc4e949d4d1a38eed17f25f3e9b3c6`
      `Compiled by brahma on 2021-04-27T14:46Z`
      `Compiled with protoc 2.5.0`
      `From source with checksum 11094d35fbde9c5d054f4eee24e710a`
      
    • If Hadoop is not installed or configured correctly, the output will be similar to:

      'hadoop' 不是内部或外部命令,也不是可运行的程序或批处理文件。

I hope the above steps successfully resolve the issue you are experiencing. If you have any further questions or need further assistance, please feel free to let me know.

Guess you like

Origin blog.csdn.net/m0_53157282/article/details/133280491