I wrote this code and compiled it in eclipse I have a text file hello.txt in the same src folder as the .class it does compile properly but wont append the Dirk Benson to the file I have no idea what is wrong.
import java.io.*; public class ioappend { /** * @param args */ public static void main(String[] args) throws IOException //TODO make try/catch for in-thread error catching { String filename; BufferedReader input = new BufferedReader ( new InputStreamReader(System.in));//TODO testing only System.out.println("Enter a file name: ");//TODO testing only filename = input.readLine();//TODO testing only FileWriter inject = new FileWriter( filename, true); inject.write("Dirk Benson"); inject.close(); } }