Skip to content

Commit

Permalink
direct get java version in runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-wang committed Aug 18, 2014
1 parent 37db9c1 commit ef1d660
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@ object CommandUtils extends Logging {
extraEnvironment = command.environment)
val userClassPath = command.classPathEntries ++ Seq(classPath)

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

0 comments on commit ef1d660

Please sign in to comment.