由于限制了所需的库rt.jar,对类的访问限制? [英] Access restriction on class due to restriction on required library rt.jar?

查看:248
本文介绍了由于限制了所需的库rt.jar,对类的访问限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译由Java的WSDL2Java在Java5上创建的Java 1.4代码,而不重新创建存根并在Eclipse中看到此错误。我假设创建的存根只要编译只要运行时可用(它们是)。



访问限制:由于对所需库C的限制,QName类型无法访问:\Program Files\Java\jdk1.5.0_16\jre\lib\rt.jar



完整的类名为 javax.xml.namespace.QName



什么这里正在发生什么?



这是我想要从香肠重构猪的情况吗?我最好重新创建存根吗?

解决方案

还有另一个解决方案也可以。我在此论坛上发现:


  1. 转到项目属性中的构建路径设置。

  2. 删除 JRE系统库

  3. 将其添加回;选择添加库,然后选择 JRE系统库。这个默认值对我来说是有效的。

这样做是因为在不同的jar文件中有多个类。删除并重新添加JRE lib将使正确的类成为第一个。
如果您想要一个基本的解决方案,请确保您使用相同的类排除jar文件。



对于我来说,我有: javax。在三个不同的jar中的xml.soap.SOAPPart axis-saaj-1.4.jar saaj-api-1.3。 jar rt.jar


I'm attempting to compile Java 1.4 code that was created by IBM's WSDL2Java on Java5 without recreating the stubs and saw this error in Eclipse. I'm under the assumption that the stubs created should just compile as long as the runtime jars are available (they are).

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

The full classname is javax.xml.namespace.QName

What exactly is going on here?

Is this a case where I am trying to refactor a pig from sausage? Am I better off recreating the stubs?

解决方案

There's another solution that also works. I found it on this forum:

  1. Go to the Build Path settings in the project properties.
  2. Remove the JRE System Library
  3. Add it back; Select "Add Library" and select the JRE System Library. The default worked for me.

This works because you have multiple classes in different jar files. Removing and re-adding the JRE lib will make the right classes be first. If you want a fundamental solution make sure you exclude the jar files with the same classes.

For me I have: javax.xml.soap.SOAPPart in three different jars: axis-saaj-1.4.jar, saaj-api-1.3.jar and the rt.jar

这篇关于由于限制了所需的库rt.jar,对类的访问限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆