Better post your code too...
Main Topics
Browse All TopicsI have created a program that just creates one file enter values to that file using filewriter,reading it again from the file for manipulation and at last I want to delete that file.Though I have given "fileobject name.delete() as given in the File class it didn't work.Could you please tell me the way to achieve this?Like this I Have the problem for renameTo() method.Please suggest any solutions
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The sample code :
==========================
import java.io.*;
public class test {
public static void main(String[] args) {
try {
System.out.println(new File("c:\\test.txt").delet
}
catch(Exception e) {e.printStackTrace();}
}
}
==========================
You can use File class to do what you want.^^
The sample code :
==========================
import java.io.*;
public class test {
public static void main(String[] args) {
try {
System.out.println(new File("c:\\test.txt").delet
}
catch(Exception e) {e.printStackTrace();}
}
}
==========================
You can use File class to do what you want.^^
The delete() method does not throw any exception (except probably RuntimeException) - it returns boolean instead.
I think that jiju_manavalan runs its application under Windows and doesn't close all Input/Output streams to this file (as csar suggested), which causes a file to be locked and thus - it cannot be deleted
jiju_manavalan:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
Business Accounts
Answer for Membership
by: CEHJPosted on 2002-11-25 at 04:57:48ID: 7493519
What's your OS?