Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/21278#discussion_r186940332
--- Diff: R/pkg/R/client.R ---
@@ -60,13 +60,39 @@ generateSparkSubmitArgs <- function(args, sparkHome,
jars, sparkSubmitOpts, pack
combinedArgs
}
+checkJavaVersion <- function() {
+ javaBin <- "java"
+ javaHome <- Sys.getenv("JAVA_HOME")
+ if (javaHome != "") {
+ javaBin <- file.path(javaHome, javaBin)
+ }
+
+ # If java is missing from PATH, we get an error in Unix and a warning in
Windows
+ javaVersionOut <- tryCatch(
+ launchScript(javaBin, "-version", wait = TRUE, stdout = TRUE, stderr
= TRUE),
+ error = function(e) {
+ stop("Java version check failed. Please make sure
Java is installed",
+ " and set JAVA_HOME to point to the installation
directory.")
+ },
+ warning = function(w) {
+ stop("Java version check failed. Please make sure
Java is installed",
+ " and set JAVA_HOME to point to the installation
directory.")
+ })
+ javaVersionStr <- strsplit(javaVersionOut[[1]], "[\"]")[[1L]][2]
+ javaVersionNum <- as.numeric(paste0(strsplit(javaVersionStr,
"[.]")[[1L]][1:2], collapse = "."))
+ if(javaVersionNum < 1.8) {
--- End diff --
nit style: space after `if`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]