eclipse中访问受限api

1、打开限制:

比如我们代码中使用sun.misc. BASE64Encoder /BASE64Decoder类默认会报错,因为它们不属于JDK标准库范畴;在JDK中包含了该类,可以使用单需要设置。

在eclipse中直接使用却找不到该类,解决方法如图:

sun.misc.BASE64Encoder找不到的解决方法_赶路人儿-CSDN博客 

2、eclipse中Access restriction问题的解决:

如果在Eclipse使用某些访问受限的API时,会报这种错误:
Access restriction: The type Resource is not accessible due to restriction on required library
这是因为Eclipse默认把这些受访问限制的API设成了ERROR,在java-compiler-Errors/Warnings选项里面的Deprecated and restricted API中的Forbidden references(access rules)选为Warning就可以编译通过,只是报警告而不是报错,保证了编译能通过。

https://www.iteye.com/blog/paddy-w-1852963

猜你喜欢

转载自blog.csdn.net/liuxiao723846/article/details/121727959