Class RuntimeEnvironment


  • public class RuntimeEnvironment
    extends java.lang.Object
    Helps query the runtime environment.
    Since:
    3.15.0
    • Constructor Summary

      Constructors 
      Constructor Description
      RuntimeEnvironment()
      Deprecated.
      Will be removed in 4.0.0.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.Boolean containsLine​(java.lang.String path, java.lang.String line)
      Tests whether the file at the given path string contains a specific line.
      static java.lang.Boolean inContainer()
      Tests whether we are running in a container like Docker or Podman.
      (package private) static java.lang.Boolean inDocker()
      Tests whether we are running in a Docker container.
      (package private) static java.lang.Boolean inPodman()
      Tests whether we are running in a Podman container.
      (package private) static java.lang.Boolean inWsl()
      Tests whether we are running in a Windows Subsystem for Linux (WSL).
      • Methods inherited from class java.lang.Object

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

      • RuntimeEnvironment

        @Deprecated
        public RuntimeEnvironment()
        Deprecated.
        Will be removed in 4.0.0.
        Constructs a new instance.
    • Method Detail

      • containsLine

        private static java.lang.Boolean containsLine​(java.lang.String path,
                                                      java.lang.String line)
        Tests whether the file at the given path string contains a specific line.
        Parameters:
        path - The path to a file.
        line - The line to find.
        Returns:
        whether the file at the given path string contains a specific line.
      • inContainer

        public static java.lang.Boolean inContainer()
        Tests whether we are running in a container like Docker or Podman.
        Returns:
        whether we are running in a container like Docker or Podman.
      • inDocker

        static java.lang.Boolean inDocker()
        Tests whether we are running in a Docker container.

        Package-private for testing.

        Returns:
        whether we are running in a Docker container.
      • inPodman

        static java.lang.Boolean inPodman()
        Tests whether we are running in a Podman container.

        Package-private for testing.

        Returns:
        whether we are running in a Podman container.
      • inWsl

        static java.lang.Boolean inWsl()
        Tests whether we are running in a Windows Subsystem for Linux (WSL).

        Package-private for testing.

        Returns:
        whether we are running in a Windows Subsystem for Linux (WSL).