Class Environment

java.lang.Object
com.teamdev.jxbrowser.os.Environment

public final class Environment extends Object
Provides the details about the current operating system, JVM architecture, JRE version etc.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Checks the current operating system name and version, JRE version and throws the EnvironmentException error if they do not meet the minimal operating system and JRE requirements.
    static Path
    Returns an absolute path to the directory where the Chromium binaries are located by default.
    static boolean
    Indicates whether the current JVM's architecture is 32-bit.
    static boolean
    Indicates whether the current JVM's architecture is 64-bit.
    static boolean
    Indicates whether the Mac CPU architecture is Apple Silicon.
    static boolean
    Indicates whether the current JVM's architecture is ARM.
    static boolean
    Returns true if the current operating system is Linux.
    static boolean
    Returns true if the current operating system is macOS.
    static boolean
    Returns true if the current environment is supported.
    static boolean
    Returns true if the current operating system is Windows.
    static boolean
    Returns true if the current platform is Windows 64-bit.
    static void
    Prints the current environment details to the log with the INFO level.
    static Path
    Returns path to the user's home directory.
    static Path
    Returns path to the user's temp directory.
    static Optional<Path>
    Returns the absolute path to the local "AppData" directory of the current Windows user.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isWindows

      public static boolean isWindows()
      Returns true if the current operating system is Windows.
    • isWindows64

      public static boolean isWindows64()
      Returns true if the current platform is Windows 64-bit.
    • isMac

      public static boolean isMac()
      Returns true if the current operating system is macOS.
    • isLinux

      public static boolean isLinux()
      Returns true if the current operating system is Linux.
    • is64Bit

      public static boolean is64Bit()
      Indicates whether the current JVM's architecture is 64-bit.
    • is32Bit

      public static boolean is32Bit()
      Indicates whether the current JVM's architecture is 32-bit.
    • isArm

      public static boolean isArm()
      Indicates whether the current JVM's architecture is ARM.
    • isAppleSilicon

      public static boolean isAppleSilicon()
      Indicates whether the Mac CPU architecture is Apple Silicon.
    • defaultChromiumDir

      public static Path defaultChromiumDir()
      Returns an absolute path to the directory where the Chromium binaries are located by default.
    • checkEnvironment

      public static void checkEnvironment()
      Checks the current operating system name and version, JRE version and throws the EnvironmentException error if they do not meet the minimal operating system and JRE requirements.
      Throws:
      EnvironmentException - when the current environment and JRE do not meet the minimal OS and JRE requirements
    • isSupported

      public static boolean isSupported()
      Returns true if the current environment is supported.
    • traceEnvironment

      public static void traceEnvironment()
      Prints the current environment details to the log with the INFO level.
    • win32UserAppDataLocalDir

      public static Optional<Path> win32UserAppDataLocalDir()
      Returns the absolute path to the local "AppData" directory of the current Windows user.
      Throws:
      IllegalStateException - when the current operating system isn't a Windows
    • userTempDir

      public static Path userTempDir()
      Returns path to the user's temp directory.
    • userHomeDir

      public static Path userHomeDir()
      Returns path to the user's home directory.