public class WindowsUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.Properties |
env |
private static java.util.logging.Logger |
LOG |
private static java.lang.String |
taskkill |
private static boolean |
THIS_IS_WINDOWS |
Constructor and Description |
---|
WindowsUtils() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
executeCommand(java.lang.String commandName,
java.lang.String... args) |
static java.io.File |
findSystemRoot()
Finds the system root directory, e.g.
|
static java.lang.String |
findTaskKill()
Finds taskkill.exe
|
static java.lang.String |
getEnvVarIgnoreCase(java.lang.String var) |
private static java.lang.String |
getEnvVarPath(java.lang.String envVar,
java.lang.String defaultValue) |
private static java.lang.String |
getFullPath(java.lang.String parent,
java.lang.String child) |
static com.google.common.collect.ImmutableList<java.lang.String> |
getPathsInProgramFiles(java.lang.String childPath) |
static java.lang.String |
getProgramFiles86Path() |
static java.lang.String |
getProgramFilesPath()
Returns the path to the Windows Program Files.
|
static void |
killByName(java.lang.String name)
Kill processes by name
|
static void |
killPID(java.lang.String processID)
Kills the specified process ID
|
static java.util.Properties |
loadEnvironment()
Returns the current process environment variables
|
static boolean |
thisIsWindows()
Returns true if the current OS is MS Windows; false otherwise
|
private static java.util.logging.Logger LOG
private static final boolean THIS_IS_WINDOWS
private static java.lang.String taskkill
private static java.util.Properties env
public static void killByName(java.lang.String name)
name
- name of the process to killpublic static void killPID(java.lang.String processID)
processID
- PID to killprivate static java.lang.String executeCommand(java.lang.String commandName, java.lang.String... args)
public static java.util.Properties loadEnvironment()
public static java.lang.String getProgramFilesPath()
public static java.lang.String getProgramFiles86Path()
private static java.lang.String getEnvVarPath(java.lang.String envVar, java.lang.String defaultValue)
public static com.google.common.collect.ImmutableList<java.lang.String> getPathsInProgramFiles(java.lang.String childPath)
private static java.lang.String getFullPath(java.lang.String parent, java.lang.String child)
public static java.lang.String getEnvVarIgnoreCase(java.lang.String var)
public static java.io.File findSystemRoot()
public static java.lang.String findTaskKill()
public static boolean thisIsWindows()