Reputation: 21
i have tried this code. I didn't create any file. I am doing this in netbeans where server is glassfish v2
public void create_file(String file_name)
{
FileWriter file_stream;
BufferedWriter out_stream;
try
{
file_stream= new FileWriter(file_name);
this.out_stream = new BufferedWriter(file_stream);
}
catch (Exception e){//Catch exception if any
}
}
Upvotes: 0
Views: 7771
Reputation: 1503779
I suspect you're passing in a relative filename - and chances are the working directory isn't what you expect it to be. I suggest you use an absolute filename, or find out an appropriate directory to create the file relative to.
It would also help if you didn't swallow exceptions - if there's something going wrong, the exception is trying to tell you about it, but you're ignoring it completely.
Upvotes: 1