public class Environment extends Properties
Modifier and Type | Field and Description |
---|---|
static String |
OSNAME
os.name System property
|
static String |
USERNAME
user.name System property
|
defaults
Constructor and Description |
---|
Environment()
Creates a snapshot of the current shell environment variables for a user.
|
Modifier and Type | Method and Description |
---|---|
static File |
getDataDirectory(String applicationname)
Returns the Data directory of the application for the logged in user.
|
static String |
getEnvVariable(String name)
Gets the value of a shell environment variable.
|
static Properties |
getEnvVariables()
Gets all environment variables within a Properties instance where the
key is the environment variable name and value is the value of the
property.
|
static File |
getSystemDirectory(String applicationname)
Returns the System directory of the application for the logged in user.
|
static String |
getUserShell()
Gets the user's shell executable.
|
static boolean |
isMacOsX()
Checks to see if the operating system is a UNIX variant.
|
static boolean |
isNetWare()
Checks to see if the operating system is NetWare.
|
static boolean |
isOpenVMS()
Checks to see if the operating system is OpenVMS.
|
static boolean |
isUnix()
Checks to see if the operating system is a UNIX variant.
|
static boolean |
isWindows()
Checks to see if the operating system is a Windows variant.
|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values
public static final String OSNAME
public static final String USERNAME
public Environment() throws EnvironmentException
EnvironmentException
- if there is an error accessing the environmentpublic static File getDataDirectory(String applicationname)
applicationname
- The name of the application.public static File getSystemDirectory(String applicationname) throws EnvironmentException
applicationname
- The name of the application.EnvironmentException
- if the current system in not Windows or Unix/Linux.public static String getEnvVariable(String name) throws EnvironmentException
name
- the name of variableEnvironmentException
- if there is a problem accessing the environmentpublic static boolean isUnix()
public static boolean isMacOsX()
public static boolean isWindows()
public static boolean isNetWare()
public static boolean isOpenVMS()
public static Properties getEnvVariables() throws EnvironmentException
EnvironmentException
- if os is not recognizedpublic static String getUserShell() throws EnvironmentException
EnvironmentException
- the there is a problem accessing shell
informationCopyright © 2006–2019 OPS4J - Open Participation Software for Java. All rights reserved.