I need to capture the exception in a text file in Java. For example:
try { File f = new File(\"\"); } catch(FileNotFoundException f) { f.printStackTrac
Try to expand on this simple example:
catch (Exception e) { PrintWriter pw = new PrintWriter(new File("file.txt")); e.printStackTrace(pw); pw.close(); }
As you can see, printStackTrace() has overloads.
printStackTrace()