## install4j API documentation

## com.install4j.api.windows
Class WinEnvVars

    java.lang.Object
      com.install4j.api.windows.WinEnvVars

    public class WinEnvVars

extends java.lang.Object

Handle global environment variables on Windows.

Author:
  ej-technologies GmbH

Constructor Summary
`WinEnvVars()`

Method Summary
`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.
`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.
`static void` | `set(java.lang.String key, java.lang.String value)` Sets a global environment variable.
`static void` | `set(java.lang.String key, java.lang.String value, boolean typeExpand)` 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.
`static void` | `setUserSpecific(java.lang.String key, java.lang.String value, boolean typeExpand)` Sets a user specific environment variable on NT/2000/XP.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WinEnvVars

    public WinEnvVars()

Method Detail

### set

    public static void set(java.lang.String key,
                           java.lang.String value)
                    throws java.io.IOException

  Sets a global environment variable. Needs an Administrator on Windows NT/2000/XP. On Windows 9X you have to restart the system afterwards, on NT/2000/XP you have to log off and on again. This is the same as calling set(key, value, false)

  Parameters:
    `key` - the name of the env var
    `value` - the value of the env var
  Throws:
    `java.io.IOException`

### set

    public static void set(java.lang.String key,
                           java.lang.String value,
                           boolean typeExpand)
                    throws java.io.IOException

  Sets a global environment variable. Needs an Administrator on Windows NT/2000/XP. On Windows 9X you have to restart the system afterwards, on NT/2000/XP you have to log off and on again.

  Parameters:
    `key` - the name of the env var
    `value` - the value of the env var
    `typeExpand` - `true` if the value contains expandable entities. This only applies to Windows NT/2000/XP
  Throws:
    `java.io.IOException`

### setUserSpecific

    public static void setUserSpecific(java.lang.String key,
                                       java.lang.String value)
                                throws java.io.IOException

  Sets a user specific environment variable on NT/2000/XP. On Windows 9x sets a global environment variable. On Windows 9X you have to restart the system afterwards, on NT/2000/XP you have to log off and on again. This is the same as calling setUserSpecific(key, value, false)

  Parameters:
    `key` - the name of the env var
    `value` - the value of the env var
  Throws:
    `java.io.IOException`

### setUserSpecific

    public static void setUserSpecific(java.lang.String key,
                                       java.lang.String value,
                                       boolean typeExpand)
                                throws java.io.IOException

  Sets a user specific environment variable on NT/2000/XP. On Windows 9x sets a global environment variable. On Windows 9X you have to restart the system afterwards, on NT/2000/XP you have to log off and on again.

  Parameters:
    `key` - the name of the env var
    `value` - the value of the env var
    `typeExpand` - `true` if the value contains expandable entities. This only applies to Windows NT/2000/XP
  Throws:
    `java.io.IOException`

### getenv

    public static java.lang.String getenv(java.lang.String key)

  Returns a single environment variable.

  Parameters:
    `key` - the name of the env var. Case doesn't matter
  Returns:
    the value of the env var or `null` if not defined

### getenv

    public static java.util.Properties getenv()

  Returns all environment variables.

  Returns:
    a property map with all environment variables and its values

### appendToPath

    public static void appendToPath(java.lang.String value)
                             throws java.io.IOException

  Appends one or more directories to the PATH environment variable. Needs an Administrator on Windows NT/2000/XP. On Windows 9X you have to restart the system afterwards, on NT/2000/XP you have to log off and on again.

  Parameters:
    `value` - the value to be appended to the path
  Throws:
    `java.io.IOException`

### prependToPath

    public static void prependToPath(java.lang.String value)
                              throws java.io.IOException

  Prepends one or more directories to the PATH environment variable. Needs an Administrator on Windows NT/2000/XP. On Windows 9X you have to restart the system afterwards, on NT/2000/XP you have to log off and on again.

  Parameters:
    `value` - the value to be appended to the path
  Throws:
    `java.io.IOException`

### appendToUserPath

    public static void appendToUserPath(java.lang.String value)
                                 throws java.io.IOException

  Appends one or more directories to the user specific PATH environment variable on Windows NT/2000/XP. Calls appendToPath for Windows 9X On Windows 9X you have to restart the system afterwards, on NT/2000/XP you have to log off and on again.

  Parameters:
    `value` - the value to be appended to the path
  Throws:
    `java.io.IOException`

### prependToUserPath

    public static void prependToUserPath(java.lang.String value)
                                  throws java.io.IOException

  Prepends one or more directories to the user specific PATH environment variable on Windows NT/2000/XP. Calls prependToPath for Windows 9X On Windows 9X you have to restart the system afterwards, on NT/2000/XP you have to log off and on again.

  Parameters:
    `value` - the value to be appended to the path
  Throws:
    `java.io.IOException`