Solved

Please help: cannot find symbol class PDDocument

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

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

760 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

19 Experts available now in Live!

Get 1:1 Help Now