用于APACHE ODF TOOLKIT(INCUBATING)的依赖项

时间:2017-05-25 08:42:40

标签: java dependencies odf

我正在尝试使用代码加载.ods文件:

import org.odftoolkit.simple.SpreadsheetDocument;
SpreadsheetDocument data = SpreadsheetDocument.loadDocument(f);

我已经添加了import语句来显示我正在使用的包。

但是我一直得到java.lang.NoClassDefFoundError。我尝试过添加许多不同的库。目前我在我的eclipse构建路径中有这些库:libraries in my eclipse build path

我收到此错误

Exception in thread "main" java.lang.NoClassDefFoundError: com/hp/hpl/jena/rdf/model/RDFNode
    at org.odftoolkit.odfdom.pkg.OdfFileDom.initialize(OdfFileDom.java:215)
    at org.odftoolkit.odfdom.pkg.manifest.OdfManifestDom.initialize(OdfManifestDom.java:74)
    at org.odftoolkit.odfdom.pkg.OdfFileDom.<init>(OdfFileDom.java:132)
    at org.odftoolkit.odfdom.pkg.manifest.OdfManifestDom.<init>(OdfManifestDom.java:63)
    at org.odftoolkit.odfdom.pkg.OdfFileDom.newFileDom(OdfFileDom.java:189)
    at org.odftoolkit.odfdom.pkg.OdfPackage.parseManifest(OdfPackage.java:1187)
    at org.odftoolkit.odfdom.pkg.OdfPackage.readZip(OdfPackage.java:454)
    at org.odftoolkit.odfdom.pkg.OdfPackage.initializeZip(OdfPackage.java:425)
    at org.odftoolkit.odfdom.pkg.OdfPackage.<init>(OdfPackage.java:256)
    at org.odftoolkit.odfdom.pkg.OdfPackage.loadPackage(OdfPackage.java:318)
    at org.odftoolkit.simple.Document.loadDocument(Document.java:319)
    at org.odftoolkit.simple.SpreadsheetDocument.loadDocument(SpreadsheetDocument.java:203)
    at FirstLoadComponent.main(FirstLoadComponent.java:11)
Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.rdf.model.RDFNode
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 13 more

任何有关如何运行我的代码或任何替代方法的建议都可以对.ods文件进行简单的读写操作。

1 个答案:

答案 0 :(得分:1)

您必须至少添加delay : Time.Time -> msg -> Cmd msg delay time msg = Process.sleep time |> Task.perform (\_ -> msg) commons-validator-1.5.0.jarjena-core-2.11.2.jar

可以通过jena-iri-1.0.2.jar命令maven获取完整的依赖项jar。

org.apache.odftoolkit:odfdom-java:jar:0.8.11-incubating
+- org.apache.odftoolkit:taglets:jar:0.8.11-incubating:compile
|  \- com.sun:tools:jar:1.7.0:system
+- xerces:xercesImpl:jar:2.9.1:compile
+- xml-apis:xml-apis:jar:1.3.04:compile
+- org.apache.jena:jena-core:jar:2.11.2:compile
|  +- org.slf4j:slf4j-api:jar:1.7.6:compile
|  +- org.apache.jena:jena-iri:jar:1.0.2:compile
|  +- org.slf4j:slf4j-log4j12:jar:1.7.6:compile
|  \- log4j:log4j:jar:1.2.17:compile
+- net.rootdev:java-rdfa:jar:0.4.2:compile
\- commons-validator:commons-validator:jar:1.5.0:compile
   +- commons-beanutils:commons-beanutils:jar:1.9.2:compile
   +- commons-digester:commons-digester:jar:1.8.1:compile
   +- commons-logging:commons-logging:jar:1.2:compile
   \- commons-collections:commons-collections:jar:3.2.2:compile

如果您以后不想获得mvn dependency:tree, 你还应该添加这些罐子。它们可以在 odftoolkit-0.6.2-incubating-bin.zip odfvalidator-1.1.8-incubating.war 中找到。