Cedric Berger
Wed Mar 3 19:31:00 GMT 2004

Erik Poupaert wrote:

>For my cgi-bin project I need to pick up the environment variables that Apache
>I'm now either up to using one of the gazillion libraries, such as libgetenv-java,
>that you find on the web, or else resort to reading /proc/self/environ, or otherwise
>working my way around this problem.
>Would you accept a patch to solve it?
>  /**
>   * This used to get an environment variable, but following Sun's lead,
>   * it now throws an Error. Use <code>getProperty</code> instead.
>   *
>   * @param name the name of the environment variable
>   * @return this does not return
>   * @throws Error this is not supported
>   * @deprecated use {@link #getProperty(String)}; getenv is not supported
>   */
>  public static String getenv(String name)
>  {
>    throw new Error("getenv no longer supported, use properties instead: "
>                    + name);
>  }
>By the way, since "Sun's lead" listens to no one else but themselves
No, they are just slow to listen.
JDK 1.5 reintroduce that function, and there is even a variant that return
all the environment in one call.

> -- and even
>then, not always -- and prefers to throw Error tantrums around, let's hope that
>IBM will be able to talk some reason into them.

More information about the Java mailing list