Skip to content

Instantly share code, notes, and snippets.

@baluragala
Created February 7, 2016 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baluragala/7b008605109fcea59505 to your computer and use it in GitHub Desktop.
Save baluragala/7b008605109fcea59505 to your computer and use it in GitHub Desktop.
Print value for a given environment variable
import java.util.Map;
import java.util.Properties;
/**
* Created by moksha on 07/02/16.
*/
public class JavaEnvironmentVariables {
public static void main(String args[]){
Map<String, String> enviorntmentVars = System.getenv();
String value = enviorntmentVars.get("TMPDIR");
System.out.println(String.format("Value for %s Key is %s","TMPDIR",value));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment