简体   繁体   English

Parso Java Library问题

[英]Parso Java Library Issue

I am trying to use the Parso Java Library in order to read in a .sas7bdat file. 我正在尝试使用Parso Java Library来读取.sas7bdat文件。 My goal is to convert it to a CSV, and then manipulate it further afterwards. 我的目标是将其转换为CSV,然后再进行操作。 Directions I am following for setting it up are here. 我正在关注设置的方向在这里。 I have the parso .jar file imported into Eclipse successfully. 我已成功导入Eclipse的parso .jar文件。 However, when I try to instantiate as so: 但是,当我尝试实例化时:

    InputStream streamIn = new FileInputStream(sasFile);
    SasFileReader sasFileReader = new SasFileReader(streamIn);

I get this exception: 我得到这个例外:

    Exception in thread "main"    
    java.lang.NoClassDefFoundError:org/slf4j/LoggerFactory
at com.ggasoftware.parso.SasFileReader.<clinit>(SasFileReader.java:30)
at sas7bdatFileConverter.convert(sas7bdatFileConverter.java:25)
at sas7bdatFileConverter.main(sas7bdatFileConverter.java:11)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

I would greatly appreciate any hints as to what I might be missing here. 我非常感谢任何关于我在这里可能缺少什么的提示。 Thank you! 谢谢!

The page you cited says you should be using a Maven dependency (which will automatically download all the jar files needed), but it seems like you are directly importing the jar file. 您引用的页面说您应该使用Maven依赖项(它将自动下载所需的所有jar文件),但您似乎直接导入了jar文件。

Because you're not using Maven, you also need to include a slf4j jar file (and that's either slf4j-api which doesn't actually do anything, or at least slf4j-simple which logs to the console). 因为你没有使用Maven,你还需要包含一个slf4j jar文件(那个slf4j-api实际上并没有做任何事情,或者至少是slf4j-simple记录到控制台)。

Simply go to http://www.slf4j.org/ and download the newest package, then take out slf4j-api-<version>.jar (and slf4j-simple-<version>.jar if you want to see the Parso library logging into your console). 只需访问http://www.slf4j.org/并下载最新的软件包,然后取出slf4j-api-<version>.jar (和slf4j-simple-<version>.jar如果你想看到Parso库登录到您的控制台)。

In the long run, definitely learn how to use Maven, it will immensely ease your pain with library management. 从长远来看,一定要学习如何使用Maven,它将极大地减轻您对图书馆管理的痛苦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM