Access restriction The type Resource is not API

Access restriction The type Resource is not API

While working with java and when you import new project or cleaned you old project or took clean build of the project, you get below exception:

Access restriction: The type ‘Resource’ is not API (restriction on required library ‘C:\Program Files (x86)\Java\jdk1.8.0_51\jre\lib\rt.jar’)

  • In eclipse you will as below:

Access restriction The type Resource is not API

  • Solution: This happens if in your class path JDK build path got mismatched. As you see below my eclipse JDK path got messed up and now J2SE-1.5 is pointing to JDK 1.8.0_51 and eclipse shows clearly this warning:

Access restriction The type Resource is not API

Access restriction The type Resource is not API

  • To fix this issue please change to proper JDK. In my case I was using JDK 1.8 so I had to change to this version:

Access restriction The type Resource is not API

Access restriction The type Resource is not API

Also don’t forget to change compiler version:

Access restriction The type Resource is not API

Reference:

Leave a Reply

Your email address will not be published. Required fields are marked *