0

I have these imports (among others):

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?

user3731598
  • 13
  • 1
  • 4

1 Answers1

0

remove this line:

import org.apache.pdfbox.*;

because that package does indeed not exist. The other ones (with deeper levels) are OK.

Tilman Hausherr
  • 17,731
  • 7
  • 58
  • 97
  • 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 '17 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. https://stackoverflow.com/questions/147454/why-is-using-a-wild-card-with-a-java-import-statement-bad – Tilman Hausherr Feb 14 '17 at 22:12
  • Thanks again! I appreciate the follow up. – user3731598 Feb 15 '17 at 23:04