diff options
author | Felix Cheung <felixcheung_m@hotmail.com> | 2017-03-21 14:24:41 -0700 |
---|---|---|
committer | Shivaram Venkataraman <shivaram@cs.berkeley.edu> | 2017-03-21 14:24:41 -0700 |
commit | a8877bdbba6df105740f909bc87a13cdd4440757 (patch) | |
tree | ada8153302373d3f1bf60e52ff79c9d262004c30 /bin | |
parent | 7dbc162f12cc1a447c85a1a2c20d32ebb5cbeacf (diff) | |
download | spark-a8877bdbba6df105740f909bc87a13cdd4440757.tar.gz spark-a8877bdbba6df105740f909bc87a13cdd4440757.tar.bz2 spark-a8877bdbba6df105740f909bc87a13cdd4440757.zip |
[SPARK-19237][SPARKR][CORE] On Windows spark-submit should handle when java is not installed
## What changes were proposed in this pull request?
When SparkR is installed as a R package there might not be any java runtime.
If it is not there SparkR's `sparkR.session()` will block waiting for the connection timeout, hanging the R IDE/shell, without any notification or message.
## How was this patch tested?
manually
- [x] need to test on Windows
Author: Felix Cheung <felixcheung_m@hotmail.com>
Closes #16596 from felixcheung/rcheckjava.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/spark-class2.cmd | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/spark-class2.cmd b/bin/spark-class2.cmd index 869c0b202f..9faa7d65f8 100644 --- a/bin/spark-class2.cmd +++ b/bin/spark-class2.cmd @@ -50,7 +50,16 @@ if not "x%SPARK_PREPEND_CLASSES%"=="x" ( rem Figure out where java is. set RUNNER=java -if not "x%JAVA_HOME%"=="x" set RUNNER=%JAVA_HOME%\bin\java +if not "x%JAVA_HOME%"=="x" ( + set RUNNER="%JAVA_HOME%\bin\java" +) else ( + where /q "%RUNNER%" + if ERRORLEVEL 1 ( + echo Java not found and JAVA_HOME environment variable is not set. + echo Install Java and set JAVA_HOME to point to the Java installation directory. + exit /b 1 + ) +) rem The launcher library prints the command to be executed in a single line suitable for being rem executed by the batch interpreter. So read all the output of the launcher into a variable. |