Jump to content
We've recently updated our Privacy Statement, available here ×

levianz

Members
  • Posts

    8
  • Joined

  • Last visited

levianz's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. 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();}
  2. I haven't been around due some connectivity problem as well Where can I find it in the API ? Experience told me that I'll need to always check the API for information, mostly regarding syntax http://jasperreports.sourceforge.net/api/index.html is where I read jasperreports API but I can't find under JasperCompileManager, so I checked it in java API, is it java io part that you used here ? To be honest I've never get into the java io part so far, so if it's not too much to ask, could you please give real line example on how to use that FileInputStream ? Thanks and regards,
  3. One short question, jasperreports 3.7.6 works with JRE 1.6 ? Thanks,
  4. JasperCompileManager.compileReportToFile("D:/JavaWS/TnD2/src/TnD2/actreport.jrxml", "D:/Reports/actreport.jasper"); jasperPrint = JasperFillManager.fillReport("D:/Reports/actreport.jasper", parameterMap, con1); There's no blank spaces and yet, it's not working on other PC, works in my development laptop though. Yes, I prefer relative path compared to absolute path, but I seems found problem with how to write it...as somehow I keep getting io error file not found with what I assume to be the right way to write it. Anyway, the problem may not because of the path or the file here, but something else that cause this in my opinion. At first I thought it's cause of SQL 7, but as I also can't point to my SQL 2000 test server, it may not be the case as well, I'm yet to try this in mysql, but I doubt it'll be of any difference. Hence I'm totally clueless on what the problem is...given a part that there's no console error message.
  5. "\"D:/Documents and Settings/Administrator/workspace/TnD2/src/TnD2/actreport.jrxml\""isn't working Modified by moving the workspace into "D:/JavaWS/TnD2/src/TnD2/actreport.jrxml" also gives me the same blank JasperViewer Also the jasper file generated is still filename.jrxml.jasper....it gives error when I use filename.jasper and when I checked, I find filename.jrxml.jasper instead All in all, problem persists. Any other suggestions ? Thanks in advance,
  6. neozerabbit Wrote: I think you have a mal formed exception or file not found exception but you do not catch it so you do not see it. Add a catch(Exception) to see what happend. You'll delete it once you've solved you problem. You seem to have a class path problem. when I see you file expression I notice there are spaces in your string. I think your problem is there. You should rather use a file path like "c:confreports..." That part is cause my workspace is in my document, anyway...you mean I have space in My Document, is it ? if it's the case then I'll move my workspace to folder without space, after trying the suggested line by augarte. btw, I catch JRException and SQLException so far I think, can you be more specific on this matter ? or do you mean like actually to print the exception to console using system.out.print ? And thanks for telling...means that mine which generate filename.jrxml.jasper is...as I thought a wrong one somehow, hopefully by no spaces in the path, all will be fixed. My 2nd question about relative path, how should it's written ? Assuming that files are in the same folder I thought I can just put the filename without any path, but it gives me io error file not found. I also tried some like using ./ or something (quite forgot since it was yesterday) and also gives the same file not found error. I personally prefer this relative path if it's really applicable cause that will reduce the effect of folder naming and path...should there be any later on. Anyway, thanks for the responses, I'll try not to use space first and see whether or not problem persists. Thanks again,
  7. I'm using JasperWave in Eclipse, with it I designed my jrxml file and then I put jasperreports code and API in my application. After done with no compilation error, I create a runnable jar out of it...it works in my laptop but when I run the jar from other PC, I see nothing in the report...just a blank JasperViewer. Also I have difficulty with using a relative path on both compiling the jrxml and filling the jasper file....as it is in the same with the java file that's calling it, I just put it as "filename.jrxml" or filename.jrxml.jasper" respectively, but that gives me java.io file not found error. Last question is does the compiling using JasperCompileManager.compileReportToFile will give filename.jrxml.jasper or will it be filename.jasper ? I'm generally new in java so please bear with me if I made a silly question. Thanks in advance, ---- re-post from iReport forum (didn't realize jasperreports have its own forum.) Code: private JasperPrint generateReport() { JasperPrint jasperPrint = null; Connection con1 = null; try { JasperCompileManager.compileReportToFile("D:/Documents and Settings/Administrator/workspace/TnD2/src/TnD2/actreport.jrxml"); try { con1 = DriverManager.getConnection("jdbc:sqlserver://xxx.xxx.xxx.xxx:xxxx;user=xxxx;password=xxxx;databaseName=xxxx"); } catch (SQLException e) { e.printStackTrace(); } HashMap<String, Object> parameterMap = new HashMap<String, Object>(); String paramValue = txNIK.getText(); parameterMap.put("NIK", paramValue); jasperPrint = JasperFillManager.fillReport("D:/Documents and Settings/Administrator/workspace/TnD2/src/TnD2/actreport.jrxml.jasper", parameterMap, con1); } catch (JRException e) { e.printStackTrace(); } return jasperPrint; }
  8. I'm using JasperWave in Eclipse, with it I designed my jrxml file and then I put jasperreports code and API in my application. After done with no compilation error, I create a runnable jar out of it...it works in my laptop but when I run the jar from other PC, I see nothing in the report...just a blank JasperViewer. Also I have difficulty with using a relative path on both compiling the jrxml and filling the jasper file....as it is in the same with the java file that's calling it I thought I can just put it as "filename.jrxml" or filename.jrxml.jasper" respectively, but that gives me java.io file not found error. Last question is does the compiling using JasperCompileManager.compileReportToFile will give filename.jrxml.jasper or will it be filename.jasper ? I'm generally new in java so please bear with me if I made a silly question. Thanks in advance, Code: private JasperPrint generateReport() { JasperPrint jasperPrint = null; Connection con1 = null; try { JasperCompileManager.compileReportToFile("D:/Documents and Settings/Administrator/workspace/TnD2/src/TnD2/actreport.jrxml"); try { con1 = DriverManager.getConnection("jdbc:sqlserver://xxx.xxx.xxx.xxx:xxxx;user=xxxx;password=xxxx;databaseName=xxxx"); } catch (SQLException e) { e.printStackTrace(); } HashMap<String, Object> parameterMap = new HashMap<String, Object>(); String paramValue = txNIK.getText(); parameterMap.put("NIK", paramValue); jasperPrint = JasperFillManager.fillReport("D:/Documents and Settings/Administrator/workspace/TnD2/src/TnD2/actreport.jrxml.jasper", parameterMap, con1); } catch (JRException e) { e.printStackTrace(); } return jasperPrint; }
×
×
  • Create New...