본문 바로가기

개발

Java Virtual Machine PROXY 환경 구성하기

728x90

프로제트를 진행하다보면 간혹 proxy 환경 안에서 개발을 해야하는 경우가 종종 생긴다.

이런 경우 처음에는 정말 멘붕이 오게 된다. 왜냐고? 정말 기본적인 것들이 동작하지 않게 되기 때문이다. ㅜㅜ

 




*그래서! jdk 에서 proxy 설정을 하는 법을 정리해 보았다! *

1. net.properties 파일 수정

~~~/java/jdk\_버젼/jre/lib 아래의 net.properties 파일 편집

java.net.useSystemProxies=false 
useSystemProxies=false
http.proxyHost=122.12.12.12
http.proxyPort=8080
https.proxyHost=12.12.12.12
https.proxyPort=8080

 

 

 

 

2. API 호출 시 SSLHandshakeException 문제를 해결하기 위해서 keystore에 인증서 추가

# example.cer 파일을 복사 
../java/jdk_버젼/jre/lib/security 폴더 아래에 example.cer 파일을 복사

# cacerts keystore에 등록 : 위 경로의 cmd 창에서 아래와 같이 입력(changeit은 cacerts의 default password)
keytool -import -alias example -keystore ./cacerts -file ./example.cer -storepass changeit