Skip to content

Instantly share code, notes, and snippets.

@stuartstevenson
Created October 13, 2015 13:25
Show Gist options
  • Save stuartstevenson/68690a12ad7c801f1389 to your computer and use it in GitHub Desktop.
Save stuartstevenson/68690a12ad7c801f1389 to your computer and use it in GitHub Desktop.
Simple java program to output system and environment variables
import java.util.Map;
import java.util.Properties;
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("---------Environment Variables----------");
Map<String, String> envs = System.getenv();
for(Map.Entry<String,String> entry : envs.entrySet()) {
System.out.println(entry.getKey() + "=" + entry.getValue());
}
System.out.println("---------System Properties----------");
System.out.println("user.home: "+System.getProperty("user.home"));
Properties props = System.getProperties();
props.list(System.out);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment