Trying to implement pdfbox in eclipse but I'm getting this error when I run it.
>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
> at org.apache.pdfbox.pdfparser.BaseParser.<clinit>(BaseParser.java:68)
> at com.pdf.util.PDFTextParser.<init>(PDFTextParser.java:26)
> at com.pdf.util.PDFTextParser.main(PDFTextParser.java:77)
>Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
> 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)
> ... 3 more
The program stops at this line of code:
parser = new PDFParser (new FileInputStream(file));
PDFParser comes from pdfbox.
I'm guessing there's something wrong with how I've attached the JAR files?
- I moved all the jar files to a folder I created called "lib" which is part of the project.
- Went into project Properties -> Java Build Path, and clicked "Add External JARs" for every JAR file
- After doing this I noticed that it said "Source attachment: none" for each of the JARs, so I clicked edit and set the destination to its location in the lib folder.
- When I go into Run Configuration, under Classpath, I can see the JAR files are there underneath my project.