Monday, 9 September 2013

Java Eclipse PrintWriter file not Found

Java Eclipse PrintWriter file not Found

I am writing to a file and want console output. This gives me console
output, but i have an error (below) the file DOES exist. :s
public static void main(String[] args) throws Exception { // TODO Create a
game engine and call the runGame() method NewGame myGame = new
TheGame().new NewGame(); myGame.runGame(); PrintStream out = new
PrintStream(new FileOutputStream("output.txt")); System.setOut(out); }
}
java.io.FileNotFoundException: TheGame.txt (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at game.main(TheGame.java:512)

No comments:

Post a Comment