Swing application exits when closing the JasperViewer frame

This happens if you directly use the JasperViewer class in your Swing application.

The viewer application implemented in this class should be considered more like a demo application that shows how the JRViewer component can be used in Swing applications to display reports.

Your application unexpectedly terminates when you close the report viewer frame because the JasperViewer class makes a call to the System.exit(0).

To get around this, use the constructor that allows you to set the isExitOnClose to "false". But you are encouraged to create your own viewer that uses the more basic visual component implemented by the JRViewer class. Feel free to copy what code portion you might want to keep from the supplied JasperViewer class.