Access Restriction: Dealing with Non-API Class Restrictions in Eclipse
Eclipse enforces access restrictions to prevent developers from inadvertently using classes outside of their intended public API. However, certain scenarios may necessitate accessing restricted classes.
Cause of Access Restriction Error
The error reported ("Access restriction: The type 'Application' is not API ...") occurs when Eclipse detects the use of a non-API class, such as com.apple.eawt.Application. This class is not explicitly included in the public API of Java.
Solution: Modifying Access Restrictions
To resolve the error and access the restricted class, modify the access restrictions within Eclipse:
This rule will grant access to all classes within the com.apple.eawt package, including the Application class.
Note:
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3