I'm not sure what the impact of Tomcat is on this, but I've used syntax
similar to this:
try {
File tf = File.createTempFile("pattern", ".suffix");
tf.deleteOnExit();
BufferedWriter out = new BufferedWriter(new FileWriter(tf));
out.write("This temporary file is deleted on close");
out.close();
}
catch (IOException e) {
...
}
HTH,
Tim
> -----Original Message-----
> From: Chris Pat [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 04, 2007 6:38 AM
> To: Tomcat Users List
> Subject: Re: tomcat temp directory
>
> Hi
> Further
> I see in catalina.bat where it is setup and all the defaults are
unchanged.
> This still does not explain why it is NOT putting the files in \temp and
> rather in just the root dir of the TC installation. I could explicitly
> force it, however that doesnt seem right.
>
> Chris Pat <[EMAIL PROTECTED]> wrote: Hi Martin, David
> Thanks.
> Where/syntax to set the tmpdir?
> Below is the syntax I use and when run from local host it puts the files
> in the "root" tomcat directory, at the same level as the all the
> subdirectories. Even outside the webapp directory. However it is
> accessible.
>
> When I switch to accessing from a domain with modjk, TC cant find the
file.
> The very same code that calls a servlet to populate a html img tag is
> blank, but the rest of the page renders correctly.
>
> I also found something claiming that TC configures its own tmp directory
> per webapp. Is that from the proper setting of CATALINA_TMPDIR in the
> server.xml? with what syntax? tia.
>
> String tempdir = System.getProperty("java.io.tmpdir");
> if (! (tempdir.endsWith("/") || tempdir.endsWith("\\"))) {
> tempdir = tempdir + System.getProperty("file.separator");
> }
> File tempFile = null;
> try {
> tempFile = File.createTempFile("myFile", "." + outputType);
> }
> catch (IOException ex2) {
> }
>
> Martin Gainty wrote: Hi Chris-
> did you set CATALINA_TMPDIR to your TOMCAT temp folder?
> M--
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed. If you have received this email message in error, please
> notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy. Thank you.
>
> ----- Original Message -----
> From: "Chris Pat"
> To: "Tomcat"
> Sent: Sunday, June 03, 2007 10:02 PM
> Subject: tomcat temp directory
>
>
> > Hello
> > How do I configure and access a temporary directory in Tomcat5x? Oddly
> I
> > am presently writing files I want to use immediately into
> java.io.tempdir
> > and it works if I access the webapp from localhost. However fails when
> > accessed from a domain.
> >
> > Within the Action/servlet how to I write/read the context specific temp
> > directory? Is there a way to release the file lock that Tomcat will
> have
> > on that file? I close all streams, but in previous primitive way it
> held
> > the lock and I had to stop/restart TC. Any help along understanding
> this
> > would be greatly appreciated.
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: [email protected]
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]