相关疑难解决方法(0)

访问限制:"应用程序"类型不是API(对所需库rt.jar的限制)

这是代码:

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);
    }
}
Run Code Online (Sandbox Code Playgroud)

这是错误:

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 …
Run Code Online (Sandbox Code Playgroud)

java eclipse macos jar

164
推荐指数
12
解决办法
24万
查看次数

如何在不运行JRE安装的情况下运行Eclipse?

我希望在Vista上运行Eclipse for C++,但我绝对不想运行JRE安装.有没有我可以在zip中获取JRE的地方,我可以将其转储到Eclipse文件夹中并让它工作?

java eclipse

23
推荐指数
2
解决办法
6万
查看次数

标签 统计

eclipse ×2

java ×2

jar ×1

macos ×1