Home >Java >javaTutorial >How to Access Restricted Classes in Eclipse: Bypassing Non-API Class Restrictions?
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:
The above is the detailed content of How to Access Restricted Classes in Eclipse: Bypassing Non-API Class Restrictions?. For more information, please follow other related articles on the PHP Chinese website!