title: FileNotFoundException in Jasper Reports
body: <p>I am trying to Compile the jasper reports file (Invoice.jrxml) but I am getting this FileNotFound Exception error </p>
  
  <p>The variable <code>sourceFileName</code> contains the name of the file 
  the file is located in </p>
  
  <p>src/com.medicam.servlets/Invoice.jrxml</p>
  
  <p>Below is my code</p>
  
  <pre><code>String [] prod = request.getParameterValues("prodn[]");
          String [] pkgdate = request.getParameterValues("pkgdate[]");
          String [] manufact = request.getParameterValues("manufact[]");
          String [] exp = request.getParameterValues("exp[]");
          String [] batch = request.getParameterValues("batch[]");
          String [] unit = request.getParameterValues("unit[]");
          String [] qty = request.getParameterValues("qty[]");
          String [] subtot = request.getParameterValues("subtot[]");
          ArrayList&lt;String&gt; prodname = new ArrayList&lt;String&gt;();
          ArrayList&lt;String&gt; packagedate = new ArrayList&lt;String&gt;();
          ArrayList&lt;String&gt; manufactdate = new ArrayList&lt;String&gt;();
          ArrayList&lt;String&gt; exipry = new ArrayList&lt;String&gt;();
          ArrayList&lt;String&gt; batchno = new ArrayList&lt;String&gt;();
          ArrayList&lt;String&gt; unitprice = new ArrayList&lt;String&gt;();
          ArrayList&lt;String&gt; quantity = new ArrayList&lt;String&gt;();
          ArrayList&lt;String&gt; Subtotal = new ArrayList&lt;String&gt;();
          Map&lt;String, Object&gt; param = new HashMap&lt;String, Object&gt;();
  
          for(int i=0;i&lt;prod.length;i++)
          {
              prodname.add(prod[i]);
              packagedate.add(pkgdate[i]);
              manufactdate.add(manufact[i]);
              exipry.add(exp[i]);
              batchno.add(batch[i]);
              unitprice.add(unit[i]);
              quantity.add(qty[i]);
              Subtotal.add(subtot[i]);
          }
          param.put("prodname", prodname);
          param.put("pkgdate", packagedate);
          param.put("manfdate", manufactdate);
          param.put("expdate", exipry);
          param.put("batch", batchno);
          param.put("unit", prodname);
          param.put("qty", quantity);
          param.put("subtot", Subtotal);
          try {
          String sourceFileName = "Invoice.jrxml";
          JasperReport jasperReport = JasperCompileManager.compileReport(sourceFileName);
          JasperFillManager.fillReportToFile(
                   sourceFileName, param);
  
          JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, param, new JREmptyDataSource());
          JasperViewer.viewReport(jasperPrint, false);
              } 
          catch (Exception e) {
                  e.printStackTrace();
              } 
  </code></pre>
  
  <p>StackTrace</p>
  
  <pre><code>net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: Invoice.jrxml (No such file or directory)
      at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
      at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:185)
      at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:176)
      at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:172)
      at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:459)
      at com.medicam.servlets.GenerateReportForPurchase.doPost(GenerateReportForPurchase.java:111)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655)
      at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.io.FileNotFoundException: Invoice.jrxml (No such file or directory)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146)
      at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:209)
      ... 29 more
  </code></pre>