title: Access restriction: The type 'Application' is not API (restriction on required library rt.jar)
body: <p>Here is the code:</p>
  
  <pre><code>package mscontroller;
  
  import javax.swing.*;
  import com.apple.eawt.Application;
  
  public class Main {
      public static void main(String[] args)
      {
          Application app = new Application();
          app.setEnabledAboutMenu(true);
  
          AMEListener listener = new AMEListener();
          app.addApplicationListener(listener);
          JFrame mainFrame = new JFrame("Application Menu Example");
          mainFrame.setSize(500, 500);
          mainFrame.setVisible(true);
      }
  }
  </code></pre>
  
  <p>here is the error:</p>
  
  <pre class="lang-none prettyprint-override"><code>Exception in thread "main" java.lang.Error: Unresolved compilation
  problems:   Access restriction: The type 'Application' is not API
  (restriction on required library
  '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
      Access restriction: The constructor 'Application()' is not API
  (restriction on required library
  '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
      Access restriction: The type 'Application' is not API (restriction on
  required library
  '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
      Access restriction: The method
  'Application.setEnabledAboutMenu(boolean)' is not API (restriction on
  required library
  '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')
      AMEListener cannot be resolved to a type    AMEListener cannot be
  resolved to a type
  
      at mscontroller.Main.main(Main.java:9)
  </code></pre>
  
  <p>eclipse says this:</p>
  
  <blockquote>
    <p>Access restriction: The type 'Application' is not API (restriction on    required library '/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre/lib/rt.jar')</p>
  </blockquote>