Hello,
I am a newbie here. I have a problem and have no idea how to solve it. I am trying to run a code for extracting text from PDF document. In order to compile and run the code, I need to add PDFBox-0.7.3.jar to the classpath. I really hope anyone can help me how to solve this problem. Thanks in advance.
The compilation is successfully done using command as below:
>javac -classpath PDFBox-0.7.3.jar PDFTextParser.java
Then, unfortunately, when I tried to run the code, it ended up to give me these errors. The command used as below:
>java -classpath PDFBox-0.7.3.jar PDFTextParser testing.pdf testOut.txt
Errors displayed
Exception in thread "main" java.lang.NoClassDefFoundError: PDFTextParser
Caused by: java.lang.ClassNotFoundException: PDFTextParser
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: PDFTextParser. Program will exit.
I have tried another way by using the command as below without setting the classpath and the different type of errors appear.
>java PDFTextParser testing.pdf testOut.txt
Errors Displayed
Parsing text from PDF file testing.pdf....
Exception in thread "main" java.lang.NoClassDefFoundError: org/pdfbox/pdfparser/PDFParser
at PDFTextParser.pdftoText(PDFTextParser.java:50)
at PDFTextParser.main(PDFTextParser.java:107)
Caused by: java.lang.ClassNotFoundException: org.pdfbox.pdfparser.PDFParser
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 2 more