Fight the Future

Java言語とJVM、そしてJavaエコシステム全般にまつわること

Javaで「Access restriction」と出たときの対処

Description	Resource	Path	Location	Type 
Access restriction: The method xxx from the type xxx is not accessible due to restriction on required library xxx\Java\lib\rt.jar	xxx.java	/xxx	line xxx	Java Problem 

と出たとき。

参考にさせていただいたサイト
[Eclipse] Access restriction: Class is not accessible due to restriction on required library - DigiZol
http://lkamal.blogspot.com/2008/09/eclipse-access-restriction-on-library.html

Eclipseで

  • Windows -> Preferences -> Java -> Compiler -> Errors/Warnings
  • (Project) Properties -> Java Compiler -> Errors/Warnings

Forbidden reference (access rules)を修正する。