본문 바로가기

Java

[error] The type BASE64Decoder is not accessible due to restriction on required library



출처 | http://devzeroty.tistory.com/entry/%EC%98%A4%EB%A5%98-The-type-BASE64Decoder-is-not-accessible-due-to-restriction-on-required-library

http://blog.naver.com/oceank/140164652647


프로젝트들을 셋팅하고 있는데 아래와 같은 에러가 났다.

Access restriction: The type BASE64Decoder is not accessible due to restriction on required library 

확인해보니 이건 로컬 이클립스 셋팅에 나는거지 소스상에 문제는 없다. (rt.jar에 있는 특정 클래스 직접 접근하려고 했을 경우 나는 에러)

 

Window -> Preferences -> java -> Compiler -> Errors/Warnings 들어가서

Deprecated and restricted API 를 활성화 시켜서 Forbidden reference (access rules) 에 Error 로 체크되어 있는걸

Ignore로 바꿔주고 Apply 하면 된다.


Access restriction: The type BASE64Decoder is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar

 

바이너리 데이터를 텍스트 데이터로 변환할 때 쓰는 Base64인코딩에 대한 구현이 자바의 sun 패키지에 포함되어 있지만,

sun.misc.BASE64Encoder와 sun.misc.BASE64Decoder는 사용해서 안되는 클래스.

sun패키지에 포함된 클래스는 직접적으로 써서는 안됨


That error is caused by your Eclipse configuration. You can reduce it to a warning. Better still, use a Base64 encoder that isn't part of a non-public API. Apache Commons has one.

 

Go to Window-->Preferences-->Java-->Compiler-->Error/Warnings.
Select Deprecated and Restricted API. Change it to warning.
Change forbidden and Discouraged Reference and change it to warning. (or as your need.)

'Java' 카테고리의 다른 글

Collection API  (0) 2016.03.08
Excel download & upload  (1) 2016.03.03
[OAuth] 인증과 권한 개념잡기  (0) 2015.10.30
google oauth2.0  (0) 2015.10.29
Using OAuth 2.0 to Access Google APIs  (0) 2015.10.29