While running the following command prompt I am getting the error as in the screenshot.
Command:
c:\spark>spark-shell
Error:
'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Why?
Suprit,
The issue is most likely with the space in your JAVA_HOME.
If the path contains spaces, use the shortened path name. For example, C:\Progra~1\Java\jdk1.8.0_131
If you are using Windows10. please try the below
Set JAVA_HOME as "C:\Progra~1\Java\jdk1.8.0_131"
Also make sure you have included %JAVA_HOME%\bin
in your PATH environment variable.
I suspect that you installed Java to a directory with a space so JAVA_HOME
breaks spark-shell
script on Windows.
Make sure you install Java to a directory with no space in the path.
The other option would be to set JAVA_HOME
to the same value but wrapped with double quotes, e.g.
set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_131"
That will likely lead to the other issue on Windows that was answered in Why does spark-shell fail with "was unexpected at this time"? that's simply to re-install Java to a directory with no space in the path.
The thing I could not check out yet would be to wrapped JAVA_HOME
using single quotes (not double quotes). That in theory would help pass the line with comparison to "x"
.
First you gotta find out where is your JAVA_HOME. In my case it is, "C:\Program Files\Java\jdk1.8.0_25\bin\java"
Then open your file called spark-class2.cmd, locate and change to your java home path (change only the bold text below).
Additional text are included for completeness only.
"C:\Program Files\Java\jdk1.8.0_25\bin\java" -Xmx128m -cp "%LAUNCH_CLASSPATH%" org.apache.spark.launcher.Main %* > %LAUNCHER_OUTPUT% for /f "tokens=*" %%i in (%LAUNCHER_OUTPUT%) do ( echo %%i set SPARK_CMD=%%i ) del %LAUNCHER_OUTPUT% %SPARK_CMD%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With