2
votes

I just finished my java project. It is made from netbeans6.9.1. It can generate report I made in jasperreport (using iReport), composed of subreports. It works perfectly in netbeans, but when I clean and build it, then tried to run the jar file in cmd (my OS is Windows XP SP3), it produces an error Could not load object from.... It points to the subreport file.

Here are some usefule infos (found in the properties of subreport): Subreport Expression : $P{SUBREPORT_DIR} + "report1.jasper". Connection type : Use a connection expression Connection Expression : $P{REPORT_CONNECTION}

Please help me. It's my first time to deploy a project. Replies are greatly appreciated.

2

2 Answers

0
votes

The problem is that you need to compile your subreport .jrxml into a .jasper file. When you use JasperReports Server, it handles this type of thing automatically. You can point to either a .jrxml file or a .jasper file and the parent report will work well.

You should first compile "report1.jrxml" into "report1.jasper". Then the rest of your existing code ought to work well.

0
votes

I've already found the answer for this. For those who will encounter the same problem, I just put my report folder the same level of executable jar file (from clean and build, inside dist folder) then made the Subreport Expression (in the subreport properties of the main report) as "./" + $P{SUBREPORT_DIR} + "report_name.jasper"