开发者

Problem running pdf2text jar. File not found exception

开发者 https://www.devze.com 2023-03-29 12:00 出处:网络
I have been trying to run the pdf2text tool provided by apache. I initially got the \'failed to load main-class manifest attribute\' error. So I modified the manifest file in the jar to include the Ma

I have been trying to run the pdf2text tool provided by apache. I initially got the 'failed to load main-class manifest attribute' error. So I modified the manifest file in the jar to include the Main-Class attribute. Wrote it as -

Main-Class: org.apache.pdfbox.ExtractText

But after this, I am getting the exception -

Exception in thread "main" java.io.FileNotFoundException: 
        org.apache.pdfbox.ExtractText (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:978)
        at org.apache.pdfbox.ExtractText.startExtraction(ExtractText.java:196)
        at org.apache.pdfbox.ExtractText.main(ExtractText.java:76)
开发者_如何学编程

What can possibly be the mistake here?


try to switch to this entry point (Main-class):

org.apache.pdfbox.PDFBox

edit: this setup should also work (if you want to extract text)

java -cp ./pdfbox-1.6.0.jar org.apache.pdfbox.PDFBox ExtractText some.pdf

note that you need to add Apache's logging package and so on to your CLASSPATH variable, unless you set that at the command line as well..

0

精彩评论

暂无评论...
验证码 换一张
取 消