Java/Java 기타
JAVA로 시스템 환경 값 가지고 오기
kimc
2022. 3. 25. 22:04
```
JAVA로 시스템 환경 값 가지고 오기
Java System.getenv()
```

이번 글을 통해 배워갈 내용
- JAVA로 시스템 환경 값 가지고 오기
Java System.getenv()
현재 시스템 환경 값을 수정할 수 없는 형태(unmodifiable)의 맵 형태로 가지고 옵니다.
public class Test {
public static void main(String[] args) {
// 시스템에 환경변수 정보를 맵(k,v) 형태로 가지고 온다
// forEach 문을 사용해서 선회하면서 출력한다.
System.getenv()
.forEach((k, v)->System.out.format("key : %s value : %s \n", k, v));
}
}
참조
https://docs.oracle.com/javase/7/docs/api/java/lang/System.html
System (Java Platform SE 7 )
Sets the system property indicated by the specified key. First, if a security manager exists, its SecurityManager.checkPermission method is called with a PropertyPermission(key, "write") permission. This may result in a SecurityException being thrown. If n
docs.oracle.com
읽어주셔서 감사합니다
무엇인가 얻어가셨기를 바라며
오늘도 즐거운 코딩하시길 바랍니다 ~ :)
728x90