Skip to content

Commit ef1d660

Browse files
committed
direct get java version in runtime
1 parent 37db9c1 commit ef1d660

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

core/src/main/scala/org/apache/spark/deploy/worker/CommandUtils.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,8 @@ object CommandUtils extends Logging {
7171
extraEnvironment = command.environment)
7272
val userClassPath = command.classPathEntries ++ Seq(classPath)
7373

74-
val runner = getEnv("JAVA_HOME", command).map(_ + "/bin/java").getOrElse("java")
75-
val jvmversion = Utils.executeAndGetOutput(Seq(runner + " -version "),
76-
extraEnvironment = command.environment)
77-
val version = jvmversion.substring(jvmversion.indexOf("\"") + 1, jvmversion.indexOf("_"))
78-
val permGenOpt = if (version.compareTo("1.8.0") < 0) Some("-XX:MaxPermSize=128m") else None
74+
val javaVersion = System.getProperty("java.version")
75+
val permGenOpt = if (!javaVersion.startsWith("1.8")) Some("-XX:MaxPermSize=128m") else None
7976
Seq("-cp", userClassPath.filterNot(_.isEmpty).mkString(File.pathSeparator)) ++
8077
permGenOpt ++ libraryOpts ++ workerLocalOpts ++ command.javaOpts ++ memoryOpts
8178
}

0 commit comments

Comments
 (0)