| Author |
Appending to file | Error
|
Saurabh Agrawal
Ranch Hand
Joined: Oct 07, 2003
Posts: 238
|
|
Hi everyone, Iam writing a very simple code to append some contents to a file; the contents are character.But in eclpise it says : Constructor BufferedWriter(File,boolean) is undefined. Here is the sample code: File file = new File(System.getProperty("user.dir") + "\\Errors\\" + filename); try { // Create file if it does not exist file.createNewFile(); } catch (IOException e) { success = false; } //use buffering Writer output = new BufferedWriter(new FileWriter(file, true)); Now this gives compilation errors saying construtor for BufferedWriter is undefined.Similarly it also sats Constructor for FileWriter is undefined. This is a simple copy and paste program, which is shpwing these errors. Can anyone site me where ia m going wrong ?? Saurabh
|
Success is not doing extraordinary things but doing ordinary things extraordinarily well.
|
 |
Manuel Moons
Ranch Hand
Joined: Mar 05, 2002
Posts: 229
|
|
It is not possible that this code gives the error that you stated above. This code: can not give this error: Constructor BufferedWriter(File,boolean) is undefined. You are not using a constructor for bufferedwriter using File and boolean parameter. You are using a constructor for FileWriter using File and boolean parameters. FileWriter does have this constructor but when you look at the javadoc for JDK 1.4 you can see that it is added in 1.4. So, your problem might be that you are not using JDK 1.4 but an earlier version.
|
 |
 |
|
|
subject: Appending to file | Error
|
|
|