相关文章推荐
还单身的红茶  ·  encodeURI() - ...·  1 月前    · 
光明磊落的登山鞋  ·  Python ...·  2 月前    · 
谈吐大方的跑步鞋  ·  Errno 9: Bad file ...·  6 月前    · 
文武双全的单车  ·  Spring Boot ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams
import org.apache.pdfbox.*;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;

I have this dependency in my pom.xml:

<dependency>
  <groupId>org.apache.pdfbox</groupId>
  <artifactId>pdfbox</artifactId>
  <version>2.0.4</version>
</dependency>

I see this line in my eclipse maven dependencies:

pdfbox-2.0.4.jar - C:\Users\Paul\.m2\repository\org\apache\pdfbox\pdfbox\2.0.4\pdfbox-2.0.4.jar

I check the build path in eclipse, and see pdfbox-2.0.4.jar in the Maven Dependencies part.

I run mvn clean compile in a command prompt (Windows).

I get the error "package org.apache.pdfbox does not exist"

I run mvn dependency:build-classpath -Dmdep.outputFile=cp.txt

The following lines are listed in the class path (at the front of the class path):

C:\Users\Paul\.m2\repository\org\apache\pdfbox\pdfbox\2.0.4\pdfbox-2.0.4.jar;
C:\Users\Paul\.m2\repository\org\apache\pdfbox\fontbox\2.0.4\fontbox-2.0.4.jar;

I look in C:\Users\Paul.m2\repository\org\apache\pdfbox\pdfbox\2.0.4\ and I see pdfbox-2.0.4.jar

So what am I missing? Why is the pdfbox jar not being found?

That certainly worked. I am a little confused why the * didn't import all, but I guess that doesn't really matter. Thanks so very. – user3731598 Feb 14, 2017 at 22:09 there is no package on the level you used, which is the top level of the core pdfbox subproject. What would have worked is import org.apache.pdfbox.pdmodel.*;. But you shouldn't use * for imports anyway. stackoverflow.com/questions/147454/… – Tilman Hausherr Feb 14, 2017 at 22:12

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.