You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Weili Lin <ai...@gmail.com> on 2018/01/05 10:44:08 UTC
org.apache.pdfbox.examples.util.PDFHighlighter could not be found
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
Re: org.apache.pdfbox.examples.util.PDFHighlighter could not be found
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 05.01.2018 um 18:12 schrieb Diego Azevedo:
> I skipped tests - I'm using Java 9 and some stuff is
> weird)
use -Pjdk9 when using maven, that should work. If not, please open an
issue or report your troubles here.
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: org.apache.pdfbox.examples.util.PDFHighlighter could not be found
Posted by Diego Azevedo <da...@esec.com.br>.
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 <ai...@gmail.com> 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
Re: org.apache.pdfbox.examples.util.PDFHighlighter could not be found
Posted by Tilman Hausherr <TH...@t-online.de>.
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: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org