Class ClasspathTools

java.lang.Object
rife.bld.extension.tools.ClasspathTools

public final class ClasspathTools extends Object
Classpath Tools.

Utility methods for assembling classpath strings from file and string path entries. null arrays, null collections, and null or blank individual entries are silently ignored in all methods.

Since:
1.0
  • Method Details

    • joinClasspath

      public static String joinClasspath(@Nullable @Nullable String... paths)
      Joins string paths into a single classpath by concatenating non-blank paths using the system's path separator.

      Blank or null paths are ignored.

      Parameters:
      paths - an array of strings representing individual classpath entries; may be null, and individual null or blank strings are silently skipped
      Returns:
      a string representing the concatenated classpath entries, separated by the system's path separator; an empty string if no valid paths are provided
      Since:
      1.0
    • joinClasspath

      @SafeVarargs public static String joinClasspath(@Nullable @Nullable Collection<File>... files)
      Joins multiple collections of files into a single classpath string using the system's path separator.

      Each file's normalized absolute path from all provided collections is included in the resulting classpath string. null collections and null individual file elements are silently ignored.

      Uses Path.toAbsolutePath() followed by Path.normalize() to resolve relative paths and eliminate redundant .. and . segments.

      Parameters:
      files - variable number of Collections of File objects representing the files to include in the classpath; may be null, and null collections or elements are skipped
      Returns:
      a classpath string where the normalized absolute paths of all provided files are joined by the system's path separator; an empty string if no valid files are provided
      Since:
      1.0