< prev index next >

src/java.base/share/classes/java/lang/System.java

Print this page

        

@@ -999,10 +999,31 @@
 
         return ProcessEnvironment.getenv();
     }
 
     /**
+     * Refreshes the current system environment variables.
+     *
+     * In the unlikely event that the system environment variables have been
+     * modified, by some out-of-band mechanism, this method will re-read the
+     * current system environment variables. Upon successful invocation of this
+     * method: 1) subsequent invocations of {@linkplain #getenv(String)
+     * getenv(String)} may return a different value, and 2) subsequent
+     * method invocations on the {@code Map} return by {@linkplain #getenv()}
+     * getenv()} may return different results.
+     *
+     * @apiNote
+     * The invocation of this method is only required if there is knowledge that
+     * an out-of-band mechanism has modified the system environment variables.
+     *
+     * @since 9
+     */
+    public static void refreshEnv() {
+        ProcessEnvironment.refreshEnv();
+    }
+
+    /**
      * {@code System.Logger} instances log messages that will be
      * routed to the underlying logging framework the {@link System.LoggerFinder
      * LoggerFinder} uses.
      * <p>
      * {@code System.Logger} instances are typically obtained from
< prev index next >