哪个.jar文件有javax.xml.stream。*? [英] which .jar file has javax.xml.stream.*?

查看:273
本文介绍了哪个.jar文件有javax.xml.stream。*?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Mac再次运行Java 1.5时遇到问题....我在哪里获得一个包含javax.xml.stream.XMLInputFactory的.jar文件?我想使用StAX但不知道如何设置它。

I have problems again with my Mac running Java 1.5.... where do I get a .jar file that has javax.xml.stream.XMLInputFactory ? I want to use StAX but don't know how to get it set up right.

我似乎无法得到这个设置。我现在已经下载了jaxp-api.jar,jsr173_1.0_api.jar,sjsxp.jar,stax-api-1.0.1.jar,stax2-api-3.0.1.jar和woodstox-core-asl-4.0。 5.jar;把它们全部放到我的java / lib / ext目录中,确保它们在我的eclipse构建路径上,删除了Mac com.apple.quarantine扩展属性,在.jar文件上做了一个chmod a + x,然后我尝试导入javax.xml.stream.XMLInputFactory;

I can't seem to get this setup. I've now downloaded jaxp-api.jar, jsr173_1.0_api.jar, sjsxp.jar, stax-api-1.0.1.jar, stax2-api-3.0.1.jar, and woodstox-core-asl-4.0.5.jar; put them all into my java/lib/ext directory, made sure they're on my eclipse build path, removed the Mac com.apple.quarantine extended attribute, did a "chmod a+x" on the .jar files, and I still get the following error trying to import javax.xml.stream.XMLInputFactory;


访问限制:类型
XMLInputFactory无法访问,因为
限制了所需的库
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext /jsr173_1.0_api.jar

Access restriction: The type XMLInputFactory is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/jsr173_1.0_api.jar

我需要做什么?

推荐答案

StAX不是Java 5的一部分;你会在 Java 6 然而。
对于Java 5,您需要下载StAX实现并将其放在类路径中。

StAX is not a part of Java 5; you'll find it in Java 6, however. For Java 5, you'll need to download a StAX implementation and place it in the classpath.

Woodstox 就是这样一种实现方式。您还可以使用 Sun Java StAX XML处理器,该处理器已进入Java SE 6。

Woodstox is one such implementation. You could also use the Sun Java StAX XML processor, which has made its way into Java SE 6.

除非我弄错了,否则这两个实现最终都会使用 jsr173_api.jar ,您可以在其中找到javax.xml.stream包。

Unless I'm mistaken, both of these implementations will eventually use the jsr173_api.jar, where you'll find the javax.xml.stream package.

更新:

Woodstox文档会引用您下载 StAX 1.0.1 API jar (使用标准StAX API时需要); Woodstox中的StAX2 API jar不包含javax.xml.stream包(尽管在运行时需要两个JAR)。 Sun实现取决于 stax-utils 项目。

The Woodstox documentation would refer you to download the StAX 1.0.1 API jar (required when you use the standard StAX API); the StAX2 API jar in Woodstox will not contain the javax.xml.stream package (although you'll need both JARs at runtime). The Sun implementation depends on the stax-utils project.

更新2

安装JSXP

SJSXP的下载文件区域看起来有点奇怪,因为你有一个类文件,而不是构建JAR。但是,获取SJSXP JAR所需的只是执行类文件,解压缩发行版。

The download files area of SJSXP looks a bit weird, in that you have a class file, instead of build JARs. However, all that is needed to obtain the SJSXP JAR, is to execute the class file, which unpacks the distribution.

获取StAX API JAR

可以从StAX实用程序项目中获取StAX API jar(jsr173_api.jar等)。它需要与sjsxp jar位于同一目录中。

The StAX API jar (jsr173_api.jar or the like) can be obtained from the StAX utilities project. It needs to be in the same directory as the sjsxp jar.

在Eclipse中使用JAR

没有必要将JAR添加到JDK的lib / ext。将两个JAR添加到项目的构建路径就足够了。

It is not necessary to add the JARs to lib/ext of the JDK. It is enough to add the two JARs to the Build Path of the project.

这篇关于哪个.jar文件有javax.xml.stream。*?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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