Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Location of Temp Directory?

Thread view: 
Barkster - 22 May 2006 22:45 GMT
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 - 22 May 2006 22:54 GMT
"Barkster" <bdog4@hotmail.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.
Signature

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 - 23 May 2006 00:58 GMT
> String tempdir = System.getProperty("java.io.tmpdir");

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

Signature

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Barkster - 23 May 2006 02:36 GMT
Thanks guys, I think my devoloper just copied some code over I would
hope he would have know this.  Appreciate it.
Barkster - 23 May 2006 02:38 GMT
Does this work on win and mac?  Thanks
Steve W. Jackson - 23 May 2006 22:02 GMT
> 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.
Signature

Steve W. Jackson
Montgomery, Alabama

Barkster - 23 May 2006 22:56 GMT


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.