由于对所需库 rt.jar 的限制,对类的访问限制?

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

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

问题描述

我正在尝试编译 IBM 的 WSDL2JavaJava5 上创建的 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_16jrelib t.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.

  1. 转到项目属性中的构建路径设置.
  2. 删除 JRE 系统库
  3. 添加回来;选择添加库" 并选择JRE 系统库.默认值对我有用.
  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.

这是因为你在不同的 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.jarsaaj-api-1.3.jarrt.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

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

本文标题为:由于对所需库 rt.jar 的限制,对类的访问限制?

基础教程推荐