public class WinEnvVars
extends java.lang.Object
Constructor and Description |
---|
WinEnvVars() |
Modifier and Type | Method and Description |
---|---|
static void |
appendToPath(java.lang.String value)
Appends one or more directories to the PATH environment variable.
|
static void |
appendToUserPath(java.lang.String value)
Appends one or more directories to the user-specific PATH environment variable on Windows NT/2000/XP/Vista.
|
static java.util.Properties |
getenv()
Returns all environment variables.
|
static java.lang.String |
getenv(java.lang.String key)
Returns a single environment variable.
|
static void |
prependToPath(java.lang.String value)
Prepends one or more directories to the PATH environment variable.
|
static void |
prependToUserPath(java.lang.String value)
Prepends one or more directories to the user-specific PATH environment variable on Windows NT/2000/XP/Vista.
|
static void |
set(java.lang.String key,
java.lang.String value)
Sets a global environment variable.
|
static void |
setUserSpecific(java.lang.String key,
java.lang.String value)
Sets a user-specific environment variable on NT/2000/XP/Vista.
|
public static void set(java.lang.String key, java.lang.String value) throws java.io.IOException
key
- the name of the environment variablevalue
- the value of the environment variablejava.io.IOException
- if the environment variable could not be setpublic static void setUserSpecific(java.lang.String key, java.lang.String value) throws java.io.IOException
key
- the name of the environment variablevalue
- the value of the environment variablejava.io.IOException
- if the environment variable could not be setpublic static java.lang.String getenv(java.lang.String key)
key
- the name of the environment variable. Case does not matter.public static java.util.Properties getenv()
public static void appendToPath(java.lang.String value) throws java.io.IOException
value
- the value to be appended to the pathjava.io.IOException
- if the environment variable could not be setpublic static void prependToPath(java.lang.String value) throws java.io.IOException
value
- the value to be appended to the pathjava.io.IOException
- if the environment variable could not be setpublic static void appendToUserPath(java.lang.String value) throws java.io.IOException
value
- the value to be appended to the pathjava.io.IOException
- if the environment variable could not be setappendToPath(String)
public static void prependToUserPath(java.lang.String value) throws java.io.IOException
value
- the value to be appended to the pathjava.io.IOException
- if the environment variable could not be setprependToPath(String)