Class JavaConfig

  • All Implemented Interfaces:

    
    public final class JavaConfig
    
                        

    Settings-group for Java-installations used by ServerPackCreator: the Java for modloader-server installs with validation and system-fallback, the per-version java-paths for script-variables, and the script-autoupdate flag. Extracted from ApiProperties (refactor Phase 1b); ApiProperties remains the facade through which consumers access these values.

    • Method Detail

      • javaPath

         final Optional<String> javaPath(Integer javaVersion)

        Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience.

        Parameters:
        javaVersion - The Java version to acquire the path for.
        Returns:

        The path to the Java executable/binary, if available.

      • javaPath

         final Optional<String> javaPath(String javaVersion)

        Get the path to the specified Java executable/binary, wrapped in an Optional for your convenience.

        Parameters:
        javaVersion - The Java version to acquire the path for.
        Returns:

        The path to the Java executable/binary, if available.

      • acquireJavaPath

         final String acquireJavaPath(String pathToJava)

        Check the given path to a Java installation for validity and return it, if it is valid. If the passed path is a UNIX symlink or Windows lnk, it is resolved, then returned. If the passed path is considered invalid, the system default is acquired and returned.

        Parameters:
        pathToJava - The path to check for whether it is a valid Java installation.
        Returns:

        Returns the path to the Java installation. If user input was incorrect, SPC will try to acquire the path automatically.

      • javaAvailable

         final Boolean javaAvailable()

        Whether a viable path to a Java executable or binary has been configured for ServerPackCreator.

        Returns:

        true if a viable path has been set.