Class RuntimeEnvironment

java.lang.Object
org.apache.commons.lang3.RuntimeEnvironment

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

    • RuntimeEnvironment

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

    • fileExists

      private static boolean fileExists(String path)
    • inContainer

      public static 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. Never null
    • inContainer

      static boolean inContainer(String dirPrefix)
    • readFile

      private static String readFile(String envVarFile, String key)
      Tests whether the /proc/N/environ file at the given path string contains a specific line prefix.
      Parameters:
      envVarFile - The path to a /proc/N/environ file.
      key - The env var key to find.
      Returns:
      value The env var value or null.