Greetings,

This is a generic Java problem, not a NetBeans issue.

Try */FileWriter fileWritter = new FileWriter(f1, true); /*instead.

-- 
Mark A. Flacy
mfl...@verizon.net

On Friday, March 12, 2021 7:01:44 PM CDT Zulfi Khan wrote:
> Hi,
> Subject: File created but message not stored
> Thanks Mark,
> Following is my program related to filing
> 
> package com.mycompany.fileWrite;
> import java.io.File;
> import java.io.FileWriter;
> import java.io.BufferedWriter;
> import java.io.IOException;
> 
> /**
>  *
>  * @author zulfi
>  */
> public class Main {
>     public static void main( String[] args ) {
> 
>       try {
>          String data = " Tutorials Point is a best website in the world";
>          File f1 = new File("/home/zulfi/abc.txt");
>          if(!f1.exists()) {
>             f1.createNewFile();
>          }
> 
>          FileWriter fileWritter = new FileWriter(f1.getName(),true);
>          BufferedWriter bw = new BufferedWriter(fileWritter);
>          bw.write(data);
>          bw.close();
>          System.out.println("Done");
>       } catch(IOException e){
>          e.printStackTrace();
>       }
>    }
>     
> }
> 
> I am running the above program on Ubuntu 18.04 using Netbeans 12.2. My
> project name is: "fileWrite". It is a Mavern, Java Application project. It
> is not writing anything in the file abc.txt:
> 
>  zulfi@lc2530hz:~$ cat abc.txt
> zulfi@lc2530hz:~$ pwd
> /home/zulfi
> zulfi@lc2530hz:~$
> 
> I have also attached the project image.
> Zulfi.
> 
> 
> 
>     On Friday, March 12, 2021, 6:50:48 PM CST, Zulfi Khan
> <zulfi6...@yahoo.com> wrote:
> 
> 
> Hi,
> Thanks Mark,
> Following is my program related to filing
> 
> package com.mycompany.fileWrite;
> import java.io.File;
> import java.io.FileWriter;
> import java.io.BufferedWriter;
> import java.io.IOException;
> 
> /**
>  *
>  * @author zulfi
>  */
> public class Main {
>     public static void main( String[] args ) {
> 
>       try {
>          String data = " Tutorials Point is a best website in the world";
>          File f1 = new File("/home/zulfi/abc.txt");
>          if(!f1.exists()) {
>             f1.createNewFile();
>          }
> 
>          FileWriter fileWritter = new FileWriter(f1.getName(),true);
>          BufferedWriter bw = new BufferedWriter(fileWritter);
>          bw.write(data);
>          bw.close();
>          System.out.println("Done");
>       } catch(IOException e){
>          e.printStackTrace();
>       }
>    }
>     
> }
> 
> I am running the above program on Ubuntu 18.04 using Netbeans 12.2. My
> project name is: "fileWrite". It is a Mavern, Java Application project. It
> is not writing anything in the file abc.txt:
> 
>  zulfi@lc2530hz:~$ cat abc.txt
> zulfi@lc2530hz:~$ pwd
> /home/zulfi
> zulfi@lc2530hz:~$
> 
> I have also attached the project image.
> Zulfi.
> 
> 
>     On Friday, March 12, 2021, 12:20:58 AM CST, Mark A. Flacy
> <mfl...@verizon.net.invalid> wrote:
> 
>  Greetings,
> 
> You are going to need to provide a lot more information before anyone even
> attempts to help you.
> 
> Why is this a Netbeans problem?  Did you make a project of some kind?  If
> so, what type of project?  What did you do via Netbeans?
> 
> You are essentially saying "I did some things and I expected some other
> things to happen, but those other things didn't happen.  Please help."
> 
> No one on this mailing list is paid by anyone to provide help; you are at
> the mercy of volunteers, who might provide help if there is an indication
> of some level of effort from the person requesting such help.
> 
> Please provide more detail upon what you did using Netbeans and what you

Reply via email to