Hi,

I have written a program that outputs numerical results to the console in java(using eclipse). The problem that i have is that i want to copy or save the entire console content to a .txt file. How could i do this please? Thank you for your help

You can search this forum for examples on how to use the BufferedWriter class:

BufferedWriter writer = null;
		try {
			writer = new BufferedWriter(new FileWriter(new File(fileName)));
				writer.write("Write this to file");
				writer.newLine();
		} catch(Exception e) {
			System.out.println(e.getMessage);
		} finally {
try { if (writer!=null) writer.close(); } catch (Exception ex) {}
		}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.