我正在尝试编译由IBM的WSDL2Java在Java5上创建的Java 1.4代码,而无需重新创建存根并在Eclipse中看到此错误.我假设创建的存根应该只要运行时jar可用就可以编译(它们是).
Access restriction: The type QName is not accessible due to restriction on required library C:\Program Files\Java\jdk1.5.0_16\jre\lib\rt.jar
完整的类名是 javax.xml.namespace.QName
到底发生了什么?
这是我试图用香肠重构一头猪的情况吗?我最好重新创建存根吗?
这是代码:
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)