Solved

Please help: cannot find symbol class PDDocument

Posted on 2013-05-11
4
532 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
allswap challenge 6 98
starter POM and spring-boot-starter,  spring-boot-web 2 54
session migration servlets 2 36
hibernate jars 4 30
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

773 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