cmaclellan Posted March 16, 2007 Share Posted March 16, 2007 I'm developing an application in JDeveloper, and everything works fine when i run it in JDeveloper, but when i build it and try to run it on it's own i run into a jasperreports compile error. c:JDeveloperjdevmyworkCECTestViewdeploy>java -jar cec.jarnet.sf.jasperreports.engine.JRException: Error compiling report java source files : c:JDeveloperjdevmyworkCECTestViewdeployclassic_1174059230720_737595.java at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:93) at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:67) at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190) at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105) at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211) at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:197) at CEC.view.DataHandler.createReport(DataHandler.java:795) at CEC.view.Report.but_Save_actionPerformed(Report.java:345) at CEC.view.Report$9.actionPerformed(Report.java:81) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)Caused by: java.io.IOException: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:62) ... 33 moreCaused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 37 more here is my code that compiles and builds my pdfs public void createReport(String key, String path, File[] file, String query) throws Exception{ // Load all the reports JasperReport[] report = new JasperReport[file.length]; JasperDesign[] design = new JasperDesign[file.length]; Map parameters = new HashMap(); design[0] = JRXmlLoader.load(getClass().getResource(file[0].toString()).openStream()); for (int i=1; i < file.length; i++){ design = JRXmlLoader.load(getClass().getResource(file.toString()).openStream()); report = JasperCompileManager.compileReport(design); System.out.println(file.toString()+": Compiled OK"«»); } // Set the custom query for the report if need be if (!query.equalsIgnoreCase(""«»)){ JRDesignQuery designQuery = new JRDesignQuery(); designQuery.setText(query); design[0].setQuery(designQuery); } // Compile the report and export it to the path that the user selected report[0] = JasperCompileManager.compileReport(design[0]); System.out.println(file[0].toString()+": Compiled OK"«»); parameters.put(key, "PDF JasperReport"«»); JasperPrint print = JasperFillManager.fillReport(report[0], parameters, conn); OutputStream output = new FileOutputStream(new File(path)); JasperExportManager.exportReportToPdfStream(print, output); output.close(); }Post edited by: cmaclellan, at: 2007/03/18 23:59 Link to comment Share on other sites More sharing options...
cmaclellan Posted March 19, 2007 Author Share Posted March 19, 2007 can anyone help me? i need to get this working asap. thanks.Post edited by: cmaclellan, at: 2007/03/19 12:53 Link to comment Share on other sites More sharing options...
cmaclellan Posted March 20, 2007 Author Share Posted March 20, 2007 i was able to solve this issue by adding the java bin directory to the PATH variable. Link to comment Share on other sites More sharing options...
c4s4l Posted May 2, 2007 Share Posted May 2, 2007 yes, the problem seems to be that the javac compiler isn't found in the path, so putting it in the path will resolve the problem. thank you all! Link to comment Share on other sites More sharing options...
teodord Posted May 2, 2007 Share Posted May 2, 2007 Hi, Putting the jdt-compiler.jar in the classpath would be even better. It is distributed with the JasperReports project in the /lib directory. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
myyoucef Posted July 7, 2014 Share Posted July 7, 2014 thank you , jdt-compiler.jar is the solution Link to comment Share on other sites More sharing options...
myyoucef Posted July 7, 2014 Share Posted July 7, 2014 thank you , jdt-compiler.jar is the solution Link to comment Share on other sites More sharing options...
salutonmondo Posted October 15, 2017 Share Posted October 15, 2017 thank you. 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