Weili, I just tried downloading the source code, and was able to use the examples after I added pdfbox and commons-logging to the classpath.
Steps: 1. download source from 2.0.8 2. mvn install (I skipped tests - I'm using Java 9 and some stuff is weird) 3. mkdir jars 4. copy pdfbox and pdfbox-examples to this folder 5. add commons logging to the folder as well (~/.m2/repository/commons-logging) 6. execute java -cp .:jars/* org.apache.pdfbox.examples.util.PDFHighlighter 7. profit Best, Diego Azevedo On Fri, Jan 5, 2018 at 8:44 AM, Weili Lin <[email protected]> wrote: > Dear pdfbox developers/maintainers, > > Sorry that the previous email is incomplete... > > For my project I need to highlight pdfs. The class org.apache.pdfbox. > examples.util.PDFHighlighter in PDFBox java project is interesting to me. > However, I could not call the class successfully after I build the project. > The error I got was > > Error: Could not find or load main class org.apache.pdfbox.examples.uti > l.PDFHighlighter > > The screenshot below shows the operation process: > > $mvn clean install -DskipTests > project was successfully installed > $cd pdfbox/examples/target/classes/org/apache/pdfbox/examples/util/ > $ ls > > DrawPrintTextLocations.class PDFHighlighter.class PrintImageLocations.class > PrintTextLocations.class > > ExtractTextByArea.class PDFMergerExample.class PrintTextColors.class > RemoveAllText.class > > $ java PDFHighlighter > > Error: Could not find or load main class PDFHighlighter > > > Then I tried: > > $cd pdfbox/examples/target/ > > $ls > > META-INF maven-status > > classes org > > generated-sources pdfbox-examples-3.0.0-SNAPSHOT-sources.jar > > generated-test-sources maven-archiver test-classesmaven-shared-archi > ve-resources > > $unzip pdfbox-examples-3.0.0-SNAPSHOT-sources.jar > > $java -cp pdfbox-examples-3.0.0-SNAPSHOT.jar org.apache.pdfbox.examples. > util.PDFHighlighter > > Error: Could not find or load main class org.apache.pdfbox.examples. > util.PDFHighlighter > > > > I can not figure out why the class could not be found. Could you please > check? > > > Best, > > Weili > -- []'s Diego Azevedo

