Hello,
In my
Java program, I am creating a file followed by datetime (ie, TowerDetail09-10-2003-03:28:04.doc) and writing into it.
I am getting this error:-
Exception in
thread "main" java.io.FileNotFoundException: TowerDetail09-10-2003-03:28:04.doc (The system cannot find the file specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:176)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at TowerDetail.main(TowerDetail.java:30)
***************
The snippet of the code is:
java.util.TimeZone tz = java.util.TimeZone.getTimeZone("EST");
java.util.Date now = new java.util.Date();
DateFormat df = new SimpleDateFormat("MM-dd-yyyy-hh:mm:ss");
df.setTimeZone(tz);
String result = df.format(now);
String fileName = "TowerDetail"+result+".doc";
File inputFile = new File(fileName);
FileOutputStream fos = new FileOutputStream(inputFile);
PrintWriter pw = new PrintWriter(fos);
Help will be appreciated.
thakns...