Results 1 to 4 of 4

Thread: Deleting files?

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Deleting files?

    Does anyone know how to delete a file?
    I have a JTextField which takes a user defined path. After i read the file i want to delete it but for some reason the delete() method doesnt work. I know there is a deleteOnExit() method but i need to have the file deleted during program execution.

    File filepath = new File(jtf.getText()); // should have .txt extension
    filepath.delete()

  2. #2
    http://java.sun.com/j2se/1.3/docs/ap...le.html#delete()

    Is it throwing an exception or just returning the wrong value?

  3. #3

  4. #4

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    I have a simple encryption/decryption program. I take a file with a .txt extension, encrypt the data (then i want to delete that file)
    next i write that encrypted data to another file with a diffrent extension. The reverse is the same i take the file with the new extension decrypt the data (now i want to delete the file with the new extension) and store the data back to the orgional file.

Posting Permissions

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



Click Here to Expand Forum to Full Width