Created
October 13, 2015 13:25
-
-
Save stuartstevenson/68690a12ad7c801f1389 to your computer and use it in GitHub Desktop.
Simple java program to output system and environment variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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