i trying write file, process can read. using printwiter write file. doesnt write file long dont terminate program. have eanbles autflush on, , explicitly flusing. code below -
import java.io.filewriter; import java.io.printwriter; public class readfile { public static void main(string[] args) { try { // create print writer filewriter fw = new filewriter("d:\\springprojects\\resciliencemodel\\natural_resource.txt"); //bufferedwriter bw = new bufferedwriter(fw); printwriter pw = new printwriter(fw, true); // experiment methods while(true) { pw.println(99); pw.flush(); } } catch (exception e) { system.out.println("exception: " + e); } } }
two issues.
check while(true) loop, or won't end.
close() handle, or won't release resources.
Comments
Post a Comment