Java PrintWriter not printing data to file
With any Java Writer or Stream... YOU MUST PROPERLY FLUSH AND CLOSE it.

The documentation is not fantastically clear... but:

when you exit the method, you must ensure that the file is flushed and closed. you are exiting your program before the data is written to disk.

Always use the following pattern when doing IO (if you are using Java7) :

try (PrintWriter output = new PrintWriter(path)) {
    output.printf("%1$s %2$.2f", title, price);
    output.flush();
}


This is a 'try-with-resource' block.