java 1.7 rt.jar,jdk1.7 / jre / lib / rt.jar的访问限制

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 }}

*

*/

@XmlElementDecl(namespace = "", name = "expenseReport")

public JAXBElement createExpenseReport(ExpenseT value) {

return new JAXBElement(_ExpenseReport_QNAME, ExpenseT.class, null, value);

}

}

解决方案

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值