이클립스에서 간혹 access restriction 문제가 발생한다.
대충
Access restriction on class due to restriction on required library
와 같은 문구가 뜬다.
내가 격은 문구는
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
위 코드를 사용하면
다음과 같이 문제가 발생한다.
Access restriction: The type Provider is not accessible due to restriction on required library C:\JDK1.6\jre\lib\jsse.jar
이럴 때는 해당 프로젝트
우클릭/프로퍼티/Java Build Path 에서 Library 탭으로 이동하면
JRE System Library [JavaSE-1.6]
과 같이 표시 되어 있다면 이 JRE를 선택 후 우측 하단 Remove를 클릭하여 삭제한다.
그 후 다시
Add Library를 선택해 JRE System Library를 추가한다.
디폴트로 선택하면 정상적으로 사용이 가능하였다.
1) 해당 프로젝트 프로퍼티/Java Build Path
2) JRE SytemLibrary 삭제
3) Add Library 클릭 후 JRE System Library 선택 후 Next
4) 디폴트인 Workspace default JRE 선택이 되었다면 Finish