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
Win a copy of
The Software Craftsman
this week in the
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
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
Have you tried LearnNowOnline?
subject: How to specify output path for an image file?
Writing Image onto a WordDoc
images in servlet
regarding file creation on server -very urgent
Accessing a folder within a web application...
File path after deployment
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015