Solved

Please help: cannot find symbol class PDDocument

Posted on 2013-05-11
4
522 Views
Last Modified: 2015-01-05
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
Comment
Question by:zizi21
4 Comments
 
LVL 25

Assisted Solution

by:Tomas Helgi Johannsson
Tomas Helgi Johannsson earned 200 total points
ID: 39159138
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
 
LVL 26

Accepted Solution

by:
dpearson earned 200 total points
ID: 39159140
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
 

Author Comment

by:zizi21
ID: 39159184
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
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 100 total points
ID: 39159339
As Tomas said, change the name of the package of your own class. PDDocument's package should remain as it is
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 76
split53 challenge 7 78
get weblogic logged in user in java 2 57
split string containing \r\n in Java 46 38
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now