Location of Temp Directory?  
Author Message
Barkster





PostPosted: 2006-5-23 5:46:00 Top

java-programmer, Location of Temp Directory? I'm having an app developed for me and they are storing the files in a
newly created folder on the C: drive but I don't want to make directory
there. Is there not a way to get the temp variable for machine, like
%temp or %tmp? Thanks

 
Real Gagnon





PostPosted: 2006-5-23 5:55:00 Top

java-programmer >> Location of Temp Directory? "Barkster" <email***@***.com> wrote in news:1148334332.450198.40590
@u72g2000cwu.googlegroups.com:

> I'm having an app developed for me and they are storing the files in a
> newly created folder on the C: drive but I don't want to make directory
> there. Is there not a way to get the temp variable for machine, like
> %temp or %tmp? Thanks
>
>

( http://www.rgagnon.com/javadetails/java-0484.html )

String tempdir = System.getProperty("java.io.tmpdir");

if ( !(tempdir.endsWith("/") || tempdir.endsWith("\\")) )
tempdir = tempdir + System.getProperty("file.separator");

Bye.
--
Real Gagnon from Quebec, Canada
* Looking for Java or PB code examples ? Visit Real's How-to
* http://www.rgagnon.com/howto.html
 
Chris Smith





PostPosted: 2006-5-23 7:58:00 Top

java-programmer >> Location of Temp Directory? Real Gagnon wrote:
> String tempdir = System.getProperty("java.io.tmpdir");
>

Or File.createTempFile is often better, depending on the situation.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
 
Barkster





PostPosted: 2006-5-23 9:37:00 Top

java-programmer >> Location of Temp Directory? Thanks guys, I think my devoloper just copied some code over I would
hope he would have know this. Appreciate it.

 
 
Barkster





PostPosted: 2006-5-23 9:38:00 Top

java-programmer >> Location of Temp Directory? Does this work on win and mac? Thanks

 
 
Steve W. Jackson





PostPosted: 2006-5-24 5:03:00 Top

java-programmer >> Location of Temp Directory? In article <email***@***.com>,
"Barkster" <email***@***.com> wrote:

> Does this work on win and mac? Thanks

It works with all platforms. The java.io.tmpdir property tells you
where the JVM will store temporary files and is set by the
implementation.
--
Steve W. Jackson
Montgomery, Alabama
 
 
Barkster





PostPosted: 2006-5-24 5:56:00 Top

java-programmer >> Location of Temp Directory? Thanks!