由于对所需库 rt.jar 的限制,对类的访问限制?
我正在尝试编译 IBM 的 WSDL2Java 在 Java5 上创建的 Java 1.4 代码,而无需重新创建存根并在 Eclipse 中看到此错误.
我假设只要运行时 jars
可用(它们是),生成的存根就应该编译.
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 generated should just compile as long as the runtime jars
are available (they are).
访问限制:由于所需库 C:Program FilesJavajdk1.5.0_16jrelibt.jar 的限制,无法访问类型 QName
完整的类名是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.
- 转到项目属性中的构建路径设置.
- 删除 JRE 系统库
- 添加回来;选择添加库" 并选择JRE 系统库.默认值对我有用.
- Go to the Build Path settings in the project properties.
- Remove the JRE System Library
- Add it back; Select "Add Library" and select the JRE System Library. The default worked for me.
这是因为你在不同的 jar 文件中有多个类.删除和重新添加 JRE 库将使正确的类成为第一.如果您想要一个基本的解决方案,请确保排除具有相同类的 jar 文件.
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.
对我来说,我有:javax.xml.soap.SOAPPart
在三个不同的 jar 中:axis-saaj-1.4.jar
、saaj-api-1.3.jar
和 rt.jar
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
相关文章