aspose file tools*
The moose likes I/O and Streams and the fly likes Creating a Temporary File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Creating a Temporary File" Watch "Creating a Temporary File" New topic
Author

Creating a Temporary File

Pranay Narotam
Greenhorn

Joined: Oct 08, 2008
Posts: 23
Hi all

I would like to create a temporary text file,and it should open up when the text file is created.

here is my code to create a temp file

Please tell me if this is correct

And can you please show me how to automatically open the temp file when it is created

Thanks

Pranay


I AM A HUMAN BEING
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Pranay Narotam wrote:
Please tell me if this is correct


Did you run your code? Did the file get created with those contents?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Pranay Narotam
Greenhorn

Joined: Oct 08, 2008
Posts: 23
Hi all

Yes i did run the code, and the file is created with the contents.

But it does not open up when it is created

Thanks

Pranay
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

How are you trying to open it?
Pranay Narotam
Greenhorn

Joined: Oct 08, 2008
Posts: 23
Well it opens up when i run it from any explorer, but I want it to open up from runtime,

Thanks

Pranay
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Check out Desktop#open(File file) if you are using 1.6+
Pranay Narotam
Greenhorn

Joined: Oct 08, 2008
Posts: 23
Sorry, I'm running 1.5

Thanks

Pranay
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Ok.
Search the forums. This question comes up quite many times. The answer has already been posted there.
Pranay Narotam
Greenhorn

Joined: Oct 08, 2008
Posts: 23
Let me explain to you exactly what I want

I have a button, when a user presses that button, a temporary
text file should be created and should appear, and when the
user closes that file, than that file should be deleted.
I got the temp file to be created, but i need it to appear when it
is created.

Thanks

Pranay
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

I got what you wanted the first time. Thanks.
Like I said search the forums on how to programatically open a file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating a Temporary File