net.sf.jasperreports.engine.JRException:Resource not found
jasper-reports, subreport
Solution
Following Sharad's answer, if it still doesn't generate the file (which happened to me), you can try this:
Before previewing the report, you can try to compile it first. If you open your jrxml file (the one that includes the subreport), you may notice a little icon (a little file with some binary string) on the upper bar of your editor. Clicking this button should generate the file you're expecting.
I created a new answer because I wanted to add an image showing the button:
Notice that this may also work: clean the projects that contain the reports using "Project > Clean...". And then right click your project in the "Project Explorer" (usually on your left), and then click "Build Project".
Problem
I try to use subreport using JasperSoft Studio but I get the exception below. It cannot find the subreport file although it is there. ``` net.sf.jasperreports.engine.JRException:Resource not found at: D:\\JASPERREPORTS\\MyReports ``` Below is the configuration of main report ``` <?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version last--> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0a6d6643-1d79-4e5e-b39d-a773bba37c12"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="kai3_adapter"/> <queryString> <![CDATA[select * from cm_crew]]> </queryString> <field name="OID" class="java.math.BigDecimal"/> <field name="CREW_OID" class="java.lang.String"/> <field name="CONTACT_OID" class="java.math.BigDecimal"/> <field name="ACTIVE" class="java.lang.String"/> <field name="ONSHIFT" class="java.lang.String"/> <field name="SHIFT_ID" class="java.lang.String"/> <field name="SHIFT_START" class="java.sql.Timestamp"/> <field name="CREW_STATUS" class="java.lang.String"/> <group name="CREW_OID"> <groupExpression><![CDATA[$F{CREW_OID}]]></groupExpression> </group> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="61" splitType="Stretch"> <staticText> <reportElement x="0" y="0" width="141" height="20" uuid="fc7cf2eb-2922-42e3-b446-fa1cba3239d6"/> <text><![CDATA[CREW_OID]]></text> </staticText> <staticText> <reportElement x="141" y="0" width="138" height="20" uuid="1fb08aed-592e-437d-9c3c-87e763dc81f8"/> <text><![CDATA[ACTIVE]]></text> </staticText> <staticText> <reportElement x="279" y="0" width="138" height="20" uuid="76eaa47f-6f18-4210-a607-a6456b1cc4ed"/> <text><![CDATA[ONSHIFT]]></text> </staticText> <staticText> <reportElement x="417" y="0" width="138" height="20" uuid="273fca2c-2b50-4157-ab3b-8545d94855f3"/> <text><![CDATA[CREW_STATUS]]></text> </staticText> </band> </columnHeader> <detail> <band height="257" splitType="Stretch"> <textField> <reportElement x="0" y="13" width="141" height="20" uuid="ef3acaa1-b11a-4b3d-b90d-7da18fc15dfa"/> <textFieldExpression><![CDATA[$F{CREW_OID}]]></textFieldExpression> </textField> <textField> <reportElement x="141" y="13" width="138" height="20" uuid="2c29e96a-d712-4aff-9449-46f523ebbad8"/> <textFieldExpression><![CDATA[$F{ACTIVE}]]></textFieldExpression> </textField> <textField> <reportElement x="279" y="13" width="81" height="20" uuid="70df46c9-e63a-45a0-8c6e-82e38c260681"/> <textFieldExpression><![CDATA[$F{ONSHIFT}]]></textFieldExpression> </textField> <subreport> <reportElement x="380" y="20" width="165" height="170" uuid="3c312fc6-a389-4e46-af09-ddb1bfaa353f"/> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["D:\\JASPERREPORTS\\MyReports\\"]]></subreportExpression> </subreport> </band> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary> </jasperReport> ```