• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 681
  • Last Modified:

Please help: cannot find symbol class PDDocument

Hi,

I am trying to use the pdf and while compiling, i get the above error. please help.

package org.apache.pdfbox.pdmodel.PDDocument;
import java.io.*;
import org.apache.pdfbox.pdmodel.PDDocument;


public class pdf{

public static void main(String args[])
{
//document = new PDDocument();
//PDPage page = new PDPage();
//document.addPage( page );
}
}
0
zizi21
Asked:
zizi21
3 Solutions
 
Tomas Helgi JohannssonCommented:
Hi!

First change the name of the package to something else.
You are using the same name of the package you are importing
which will confuse the compiler.

package org.apache.pdfbox.pdmodel.PDDocument;
import java.io.*;
import org.apache.pdfbox.pdmodel.PDDocument;

Regards,
    Tomas Helgi
0
 
dpearsonCommented:
It looks like the pdfbox jars are not on the classpath.  

If you're not familiar with setting up the classpath you can read details here (for Windows):
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html

E.g. This is one way to set the path from the command line when running the Java compiler:
javac -classpath C:\java\MyClasses\myclasses.jar utility.myapp.Cool

Doug
0
 
zizi21Author Commented:
I have changed and used eclipse to set classpath as i have spend hours doing it manually.
I think, it works on eclipse. Do i still need to use the package ? i get error with it .
0
 
CEHJCommented:
As Tomas said, change the name of the package of your own class. PDDocument's package should remain as it is
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now