Results 1 to 4 of 4
  1. #1
    henry123 is offline Member
    Join Date
    Feb 2011
    Posts
    22
    Rep Power
    0

    Default create a file on application server and delete later

    Hi
    I am creating an xml file in my application and delete it later. The file is created in the same directory where I read the original file from pathToFile given by the user. The application will be deployed on application servers (bea) running on Solaris , Windows, etc
    Question: what is the safest way to create such temporary file, meaning in which directory of the system. Thanks in advance

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    It's OS specific, unfortunately, here's what the wiki has to say:

    Temporary folder - Wikipedia, the free encyclopedia


    In MS-DOS and Microsoft Windows, the temporary directory is set by the environment variable TEMP. Originally, the default was c:\Temp, then %Windows%\Temp. In modern versions, the temporary directory is set per-user as Local Settings\Temp, although it is still user-relocatable.

    In Unix and Linux, the global temporary directories are /tmp and /var/tmp. Websites periodically write data to the tmp directory during page views and downloads. Typically, /var/tmp is for persistent files (as it may be preserved over reboots), and /tmp is for more temporary files. See Filesystem Hierarchy Standard. In addition, a user can set his TMPDIR environment variable to point to a preferred directory (where the creation and modification of files is allowed).

  3. #3
    henry123 is offline Member
    Join Date
    Feb 2011
    Posts
    22
    Rep Power
    0

    Default

    @toadaly
    thanks! Let say, I can not change the directory where I write the temporary file at the time because of following issue: this temporary file is a wsdl file which has relative paths to the xsd files and wehn I create the temporary wsdl file in other directory than where I read the original wsdl, the XML parser lose the relationship between wsdl and its xsd files.
    For this situation is there a way to get the write privilege by the java application? Oris there any other solution than what I have now ?
    regards

  4. #4
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    Well, if you are working within a webserver sandbox, you'll need to read the documentation for your specific webserver to find out the proper place for temporary files. Otherwise, you're stuck writing temporary files to some application specific temp directory you create. This means your application will need to manually check that directory at startup to delete anything in it.

Similar Threads

  1. how to create exe file for web application
    By m_chenna in forum Java Software
    Replies: 5
    Last Post: 02-07-2011, 10:37 AM
  2. how to create exe file for web application
    By m_chenna in forum Eclipse
    Replies: 0
    Last Post: 02-05-2011, 09:58 AM
  3. how to create exe file for web application
    By m_chenna in forum New To Java
    Replies: 0
    Last Post: 02-05-2011, 09:58 AM
  4. How to create file on server?
    By thevoice in forum New To Java
    Replies: 10
    Last Post: 08-12-2010, 06:06 PM
  5. Replies: 5
    Last Post: 08-25-2009, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •