If I do this:
java -cp pdfbox-examples-2.0.8.jar
org.apache.pdfbox.examples.util.PDFHighlighter
then I get:
Fehler: Hauptklasse org.apache.pdfbox.examples.util.PDFHighlighter
konnte nicht gefunden oder geladen werden
Ursache: java.lang.NoClassDefFoundError:
org/apache/pdfbox/text/PDFTextStripper
So maybe you missed the rest of your error message. Your text was most
likely not in german, but it certainly mentioned PDFTextStripper.
You need to add the rest of the library as well. Either use all the
dependencies individually (see web page), or add the pdfbox-app to your
classpath.
So your call is more like
java -cp "pdfbox-examples-2.0.8.jar;pdfbox-app-2.0.8.jar"
org.apache.pdfbox.examples.util.PDFHighlighter
Tilman
Am 05.01.2018 um 11:44 schrieb Weili Lin:
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]