jdk1.7 / jre / lib / rt.jar的访问限制 [英] Access restriction on jdk1.7/jre/lib/rt.jar
问题描述
大家好,我在创建JAXB解析器时遇到了一个非常奇怪的问题。当我试图从eclipse生成JAXB类时,在一个类中它显示一个非常奇怪的错误,
hi folks I faced a very strange while creating my JAXB parser. When i tried to generate JAXB classes from eclipse then in one class it shows a very Strange error which is
Access restriction: The type QName is not accessible due to restriction on required library /usr/lib/jvm/jdk1.7.0_02/jre/lib/rt.jar
这是我的班级
package generated;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
//import javax.xml.namespace.QName;
import javax.xml.namespace.*;
@XmlRegistry
public class ObjectFactory {
和我在这一行我收到错误消息
AND HERE ON THIS LINE I AM GETTING THE ERROR MESSAGE
私人最终静态QName _ExpenseReport_QNAME =新QName(,expenseReport);
private final static QName _ExpenseReport_QNAME = new QName("", "expenseReport");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ExpenseT }
*
*/
public ExpenseT createExpenseT() {
return new ExpenseT();
}
/**
* Create an instance of {@link UserT }
*
*/
public UserT createUserT() {
return new UserT();
}
/**
* Create an instance of {@link ItemT }
*
*/
public ItemT createItemT() {
return new ItemT();
}
/**
* Create an instance of {@link ItemListT }
*
*/
public ItemListT createItemListT() {
return new ItemListT();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ExpenseT }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "expenseReport")
public JAXBElement<ExpenseT> createExpenseReport(ExpenseT value) {
return new JAXBElement<ExpenseT>(_ExpenseReport_QNAME, ExpenseT.class, null, value);
}
}
推荐答案
如果类路径引用 JRE
而不是项目打开的 JDK
,则会出现此问题进入,做一件事去
This problem occurs when you class path is referring to JRE
instead of the JDK
in which the Project is open into , do one thing go to
构建路径>库
Build Path > Libraries
删除包含的Runtime并添加 jdk
运行时,它应该现在解决你的问题。
Remove the Runtime that is included and add the jdk
runtime , it should solve your problem now.
这篇关于jdk1.7 / jre / lib / rt.jar的访问限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!