Hi, I was trying to write to a file. It worked fine with DataOutputStream p = new DataOutputStream(new FileOutputStream("Demo.txt")); p.write("Hello"); This wrote "Hello" to file Demo.txt. But when i did the following PrintWriter p = new PrintWriter(new FileWriter("Demo.txt")); p.write("Hello"); It did not write anything on to the file Demo.txt. Instead, a batch file was created with the following text @ECHO OFF C: CD "\Java\JTips Mock Exams" C:\jdk1.3\bin\java.exe input PAUSE The file name that i used was input.java and i was working in this directory c:\Java\JTips Mock Exams. I dont know why this was happening. Thanks in advance. I am using jdk1.3 Shankar
Joined: Jan 30, 2000
Did you flush and close P?
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Joined: Jan 14, 2001
Thanks Alicea. I did not flush and close previously. I did add p.flush and p.close this time. It did write to the file. But it still creates the batch file. Thanks for your help. Shankar