Home > Java > javaTutorial > How to Overcome \'Access restriction: The type \'Application\' is not API\' Error When Using javax.swing.JFrame and com.apple.eawt.Application?

How to Overcome \'Access restriction: The type \'Application\' is not API\' Error When Using javax.swing.JFrame and com.apple.eawt.Application?

Susan Sarandon
Release: 2024-10-29 10:28:02
Original
776 people have browsed it

How to Overcome

Access restriction: The Type 'Application' is Not API

When attempting to utilize the javax.swing.JFrame and com.apple.eawt.Application classes, an error can arise indicating "Access restriction: The type 'Application' is not API." This issue pertains to Eclipse's access restriction mechanism, preventing the use of non-public API classes.

Addressing the Issue

To resolve this error, modify the project's access restrictions:

  1. Navigate to the project's "Properties" menu from the "Package Explorer."
  2. Select the "Java Build Path" and then the "Libraries" tab.
  3. Expand the library entry containing the restricted class (rt.jar).
  4. Access the "Access rules" section.
  5. Click "Edit..." and then "Add..." to create a new access rule.
  6. Set the "Resolution" as "Accessible" and the "Rule pattern" as "com/apple/eawt/**" to grant access to the Application class.

By implementing these steps, you can effectively override Eclipse's access restrictions and allow the use of the Application class.

The above is the detailed content of How to Overcome \'Access restriction: The type \'Application\' is not API\' Error When Using javax.swing.JFrame and com.apple.eawt.Application?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template