Class JavaRunnerUtil


  • public class JavaRunnerUtil
    extends java.lang.Object
    Author:
    Sergey.Anchipolevsky Date: 18.04.2007
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.String> composeSystemProperties​(AgentRunningBuild build, BuildRunnerContext runnerContext)
      Returns "default" set of system properties for the java process being launched
      static java.util.List<java.lang.String> extractJvmArgs​(java.lang.String userDefinedArgs)  
      static java.util.List<java.lang.String> extractJvmArgs​(java.util.Map<java.lang.String,​java.lang.String> runParameters)  
      static java.lang.String findJavaExecutable​(java.lang.String explicitlyDefinedJavaHome, java.util.Map<java.lang.String,​java.lang.String> propsAndVars, java.lang.String baseDir)
      Finds Java executable (java.exe) using the specified parameters: - explicitly defined path - map of properties and environment variables (with corresponding prefixes) If found path is relative, it will be resolved against base dir.
      static java.io.File findJavaExecutablePath​(java.lang.String explicitlyDefinedJavaHome, java.util.Map<java.lang.String,​java.lang.String> propsAndVars, java.lang.String baseDir)
      Finds Java executable (java.exe) using the specified parameters: - explicitly defined path - map of properties and environment variables (with corresponding prefixes) If found path is relative, it will be resolved against base dir.
      static java.lang.String findJavaHome​(java.lang.String explicitlyDefinedJavaHome, java.util.Map<java.lang.String,​java.lang.String> propsAndVars, java.lang.String baseDir)
      Finds Java home - path to a directory where Java is installed.
      static java.util.List<java.lang.String> makeParamListFromProps​(java.util.Map<java.lang.String,​java.lang.String> allProps)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • makeParamListFromProps

        public static java.util.List<java.lang.String> makeParamListFromProps​(java.util.Map<java.lang.String,​java.lang.String> allProps)
      • composeSystemProperties

        @NotNull
        public static java.util.Map<java.lang.String,​java.lang.String> composeSystemProperties​(@NotNull
                                                                                                     AgentRunningBuild build,
                                                                                                     @NotNull
                                                                                                     BuildRunnerContext runnerContext)
        Returns "default" set of system properties for the java process being launched
        Parameters:
        build - agent running build
        runnerContext - runner context
        Returns:
        Map with the properties
      • findJavaExecutable

        @Nullable
        public static java.lang.String findJavaExecutable​(@Nullable
                                                          java.lang.String explicitlyDefinedJavaHome,
                                                          @NotNull
                                                          java.util.Map<java.lang.String,​java.lang.String> propsAndVars,
                                                          @Nullable
                                                          java.lang.String baseDir)
        Finds Java executable (java.exe) using the specified parameters: - explicitly defined path - map of properties and environment variables (with corresponding prefixes) If found path is relative, it will be resolved against base dir.
        Parameters:
        explicitlyDefinedJavaHome - explicitly defined path
        propsAndVars - map of properties and environment variables (with corresponding prefixes)
        baseDir - base directory to be used for relative path
        Returns:
        path to existing java executable or null
      • findJavaExecutablePath

        @Nullable
        public static java.io.File findJavaExecutablePath​(@Nullable
                                                          java.lang.String explicitlyDefinedJavaHome,
                                                          @NotNull
                                                          java.util.Map<java.lang.String,​java.lang.String> propsAndVars,
                                                          @Nullable
                                                          java.lang.String baseDir)
        Finds Java executable (java.exe) using the specified parameters: - explicitly defined path - map of properties and environment variables (with corresponding prefixes) If found path is relative, it will be resolved against base dir. No file existence checks are performed. Path will end with 'java.exe' in windows and with 'java' on all other OSes.
        Parameters:
        explicitlyDefinedJavaHome - explicitly defined path
        propsAndVars - map of properties and environment variables (with corresponding prefixes)
        baseDir - base directory to be used for relative path
        Returns:
        found and possible resolved absolute path to java executable, null is returned is no candidate paths are found at all
      • findJavaHome

        @Nullable
        public static java.lang.String findJavaHome​(@Nullable
                                                    java.lang.String explicitlyDefinedJavaHome,
                                                    @NotNull
                                                    java.util.Map<java.lang.String,​java.lang.String> propsAndVars,
                                                    @Nullable
                                                    java.lang.String baseDir)
        Finds Java home - path to a directory where Java is installed.
        Parameters:
        explicitlyDefinedJavaHome - explicitly defined path
        propsAndVars - map of properties and environment variables (with corresponding prefixes)
        baseDir - base directory to be used for relative path
        Returns:
        Java home - path to a directory where Java is installed
      • extractJvmArgs

        @NotNull
        public static java.util.List<java.lang.String> extractJvmArgs​(@NotNull
                                                                      java.util.Map<java.lang.String,​java.lang.String> runParameters)
      • extractJvmArgs

        @NotNull
        public static java.util.List<java.lang.String> extractJvmArgs​(@NotNull
                                                                      java.lang.String userDefinedArgs)