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:
-
Move the Java JDK directory from
C:\Program Files\Java
to a directory without spaces, such asC:\Java
. -
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.
-
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
.
- Click the "Edit" button and update the variable value to the new Java JDK path, which is
-
Confirm the changes and close all windows.
-
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:
-
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.
-
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.