Change:
JasperViewer.viewReport(jasperPrint);
To:
JasperViewer.viewReport(jasperPrint);
JasperViewer.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
It would seem theJasperViewer
is using JFrame.EXIT_ON_CLOSE
which will cause System.exit(n)
to be called, thus ending the JVM.
By using JFrame.DISPOSE_ON_CLOSE
instead, only that frame is ended & disposed of.