Class JavaRunnerUtil


  • public class JavaRunnerUtil
    extends Object
    Author:
    Sergey.Anchipolevsky Date: 18.04.2007
    • Method Detail

      • composeSystemProperties

        @NotNull
        public static Map<String,​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 String findJavaExecutable​(@Nullable
                                                String explicitlyDefinedJavaHome,
                                                @NotNull
                                                Map<String,​String> propsAndVars,
                                                @Nullable
                                                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 File findJavaExecutablePath​(@Nullable
                                                  String explicitlyDefinedJavaHome,
                                                  @NotNull
                                                  Map<String,​String> propsAndVars,
                                                  @Nullable
                                                  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 String findJavaHome​(@Nullable
                                          String explicitlyDefinedJavaHome,
                                          @NotNull
                                          Map<String,​String> propsAndVars,
                                          @Nullable
                                          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 List<String> extractJvmArgs​(@NotNull
                                                  String userDefinedArgs)