File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
How to specify output path for an image file?
Joined: Sep 12, 2006
Mar 18, 2007 17:20:00
I have an application deployed on
. The application is supposed to generate an Image file (myImage.png).
I want to display this image on a
page. When i run the application the image file is not generated in any of tomcat folder hierarchy.
The way i have specified the output path for the image is
PlanarImage image = PlanarImage.wrapRenderedImage(bi); String outputFile = "newpngG.png"; JAI.create("filestore", image, outputFile, "PNG", null);
How do i specify path so that this image is output in my tomcat/webapps/app folder?
Thank you in advance.
Joined: Dec 11, 2004
Mar 19, 2007 03:59:00
If the image is not under your webapp's directory structure, you'll need to write a
that streams the image to the browser.
This is not difficult.
I have an example app that does this.
Look for SimpleStream.
In that app, I'm using getResourceAsStream to read image files under the webapp's directory structure but hidden from the web under WEB-INF.
In your case, you will have to use
to read your image files but, otherwise, everything should be the same.
How to ask a question...
Simple Servlet Examples
I agree. Here's the link:
subject: How to specify output path for an image file?
File path after deployment
Accessing a folder within a web application...
images in servlet
regarding file creation on server -very urgent
Writing Image onto a WordDoc
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013