Although it was clear to me what happened immediately as I saw stacktrace, I was surprised that it didn't came to my mind during development. One of the tasks I had was to create report in the very simple application. As I wasn't sure about structure of the report and all the fields that should appear in the report I have decided to use jrxml file. jrxml file is XML definition of report and to display it you have to compile it during runtime. The code to do this is actually very simple:
JasperReport report = JasperCompileManager.compileReport("report.jrxml");
When you have instance of the report it is enough to use JasperFillManager to fill it with data.Another possibility is to compile jrxml file to jasper report. This will generate jasper, binary version of the report. When you have compiled report of course you don't have to compile it during runtime.Well, more or less I had XML version of the report, created installation using Null Soft installer, installed it on my computer and everything worked fine. I could create domain objects and display and print reports. So I was happy and delivered the installation to customer (in this case my mom). She installed application without problems, entered necessary data and tried to open report. And then to my surprise report didn't opened but there was message about unexpected error. As soon as I saw the stacktrace it was clear that actually she does not have java installed with JDK but as JRE.And of course JRE is not delivered with compiler and therefore application was not able to compile report. As soon as I changed application to read compiled report everything worked fine. So if you plan to deliver Java application to standard user computers, don't forget to test application on computers where only JRE is installed.
No comments:
Post a Comment