Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue in running code using JasperReports API on different machines
    primarykey
    data
    text
    <p>I created a Java project which will use <em>JasperReports API</em>. I have tested this inside and outside <em>NetBeans</em> (same machine) and it works fine. But when I try to run it on another machine the report wont load.</p> <p>My code is:</p> <pre class="lang-java prettyprint-override"><code>package reportmonitory; import java.sql.*; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.swing.JRViewer; import javax.swing.*; public class monthlyreport extends JFrame { Connection con; Statement stmt; ResultSet rs; void showReport() { try { String host = "jdbc:mysql://192.168.10.11/rmcdb"; String uName = "root"; String uPass = ""; Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(host, uName, uPass); stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); String reportName = "reports/finalreport.jasper"; java.io.InputStream is = this.getClass().getClassLoader().getResourceAsStream(reportName); JasperPrint print = JasperFillManager.fillReport(is, null, con); JRViewer viewer = new JRViewer(print); viewer.setOpaque(true); viewer.setVisible(true); this.add(viewer); this.setSize(1000, 1000); this.setVisible(true); this.setDefaultCloseOperation(HIDE_ON_CLOSE); } catch (Exception ex) { System.out.println("CAUSE: " + ex.getCause()); System.out.println("MESSAGE" + ex.getMessage()); System.out.println("LOCAL MESSAGE" + ex.getLocalizedMessage()); ex.printStackTrace(); } } public static void main(String args[]) { new monthlyreport().showReport(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload