Access restriction on jdk1.7/jre/lib/rt.jar
jakarta-ee, java, java-7
Solution
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
Remove the Runtime that is included and add the `jdk` runtime , it should solve your problem now.
Problem
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 ``` this is my class ``` 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 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); } } ```