Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't finding JPG file path

800478Apr 16 2008 — edited Apr 18 2008
Hi in my application we have to make PDF(itext.jar) with JPG header, I can able to create PDF but while looking for the JPG path, I'm getting the FileNotFoundException.

If I give the following path, then I get the excpetion.

1) Image jpg = Image.getInstance("WebContent//pages//jpg//bg-header.jpg");
document.add(jpg);
then I got
java.io.FileNotFoundException: C:\WebContent\pages\jpg\bg-header.jpg (The system cannot find the path specified.)

2) Image jpg = Image.getInstance("/pages/jpg/bg-header.jpg");
document.add(jpg);
then I got
java.io.FileNotFoundException: C:\pages\jpg\bg-header.jpg (The system cannot find the path specified.)


If I used the following code
3) String jpgFile = request.getContextPath() + "/pages/jpg/sports_header.jpg";

Image jpg = Image.getInstance(jpgFile);

document.add(jpg);

I got the similar
java.io.FileNotFoundException: C:\FiskarsTeacher\pages\jpg\sports_header.jpg (The system cannot find the path specified.)


I might use the wrong path to locate: what is the wright way
could someone give me the solution to find out the path

--------------------

Thanks,
Sumant K
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 16 2008
Added on Apr 16 2008
3 comments
493 views