levianz Posted December 20, 2011 Share Posted December 20, 2011 I'm having a weird problem here.I made reports using jasperreports and so far it was shown well in the development laptop, but it's not shown in the client (by running the same runnable jar file).I have no idea what the problem is, cause I can see the jasper file was generated but the jasperviewer doesn't show it up in the screen as seen in development laptop. Thanks in advance,Here's a part of the code that handles the jasperreports : Code:private void displayReports(int repName) throws JRException, SQLException { con1 = DriverManager.getConnection("jdbc:jtds:sqlserver://xx.xx.xx.xx:1433/db;user=sa;password=passdb"); HashMap<String, Object> parameterMap = new HashMap<String, Object>(); switch (repName){ case 0: parameterMap.put("label", txlabel.getText()); jasperCompileManager.compileReportToFile("Reports\\report.jrxml", "Reports\\" + txlabel.getText().toString().trim() + ".jasper"); jasperPrint = JasperFillManager.fillreport("Reports\\" + txlabel.getText().toString().trim() + ".jasper", parameterMap, con1); break; case 1: }; JasperViewer jasperViewer = new JasperViewer(jasperPrint, false); jasperViewer.setVisible(true); jasperViewer.setDefaultCloseOperation(DISPOSE_ON_CLOSE); parameterMap.clear();} Link to comment Share on other sites More sharing options...
augarte Posted December 22, 2011 Share Posted December 22, 2011 Hi, I have checked your code and I use JasperViewer in a different way. There is a static function 'viewReport' than can be used directly: JasperViewer.viewReport (jasperPrint);I have always used the viewer in this way and always has worked.Hope this helps.Regards. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now