public class Environment { public static void main(String[] argv){ String path = System.getenv("PATH"); System.out.println( "path = " + path ); } }
path = %USERPROFILE%\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\Docker Toolbox;
The environment variables can be accessed in java using the System object. The getEnv method returns the variables using their names in the environment.