Solved

Please help: cannot find symbol class PDDocument

Posted on 2013-05-11
4
569 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 27

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

728 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