Error compiling report java source files

0
Hi I´m trying to compile a report in this way

JasperReport report = JasperCompileManager.compileReport(this.getClass().getClassLoader().getResourceAsStream(resumenCorteComite.xml));

that instruction run well in a OC4J Container in Windows xp but when I try to run this one in a OC4J Container in a Solaris I get the follow error:

Caused by: java.io.IOException: javac: not found
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:52)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:566)
at java.lang.Runtime.exec(Runtime.java:491)
at java.lang.Runtime.exec(Runtime.java:457)
at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:62)

14:03:23,138 ERROR
net.sf.jasperreports.engine.JRException:
Error compiling report java source files :
/ias/j2ee/home/resumenCorteComite_1177956202947_79853.java

Please anyBody can help me?

Thank a lot
sordonez's picture
Joined: Mar 5 2007 - 11:52pm
Last seen: 7 years 1 month ago

7 Answers:

0
Hi,

Just put the jdt-compiler.jar in the classpath of you application. You can find it in the /lib directory of the JR distribution package.
But first of all, I would make sure I really need to compile report templates at runtime. Usually you don't, as you can deploy *.jasper files as part of you application JAR files. Only when dealing with dynamic report templates you need runtime report compilation, but that is rather a rare occurrence.

I hope this helps.
Teodor
teodord's picture
2817
Joined: Jun 30 2006 - 9:00am
Last seen: 1 month 1 day ago
0
Hi teodor, thanks for your answer. I will try to resolve the problem with the jdt-compiler.jar in the classpath
but I create my reports using:

JasperReport report =
JasperCompileManager.compileReport(this.getClass().getClassLoader() .getResourceAsStream(resumenCorteComite.xml));

JasperFillManager.fillReport(report, parameters, connection);

How can I create my object JasperReport using just the .jasper?

thanks again.
sordonez's picture
Joined: Mar 5 2007 - 11:52pm
Last seen: 7 years 1 month ago
0
To load a report from a .jasper file (compiled report file), you would do something like
Code:
<br />
InputStream jasperResource = this.getClass().getClassLoader() .getResourceAsStream(...);<br />
JasperReport report = (JasperReport) JRLoader.loadObject(jasperResource);<br />
</td></tr></tbody></table><br />
<br />
HTH,<br />
Lucian
lucianc's picture
5187
Joined: Jul 17 2006 - 1:10am
Last seen: 1 hour 49 min ago
0
Why does it need this jar on UNIX/Linux? We are having this problem as well.
ekr's picture
ekr
2
Joined: May 9 2008 - 10:20am
Last seen: 5 years 11 months ago
0
See [url=http://www.jasperforge.org/jaspersoft/opensource/business_intelligence/j... FAQ. If you don't want to use the JDT compiler, make sure that the javac command is available on the process path, or that you have the JDK's tools.jar on the application's classpath.

Regards,
Lucian
lucianc's picture
5187
Joined: Jul 17 2006 - 1:10am
Last seen: 1 hour 49 min ago
0
Thanks so much for your answer.
ekr's picture
ekr
2
Joined: May 9 2008 - 10:20am
Last seen: 5 years 11 months ago
0
Error compiling the report Java source.
java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/compiler/env/INameEnvironment at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:576) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.eclipse.jdt.internal.compiler.env.INameEnvironment at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 2 more
Compilation running time: 32.
**********************************************

I was interrupted by this error in iReport software when i try to compile my .jrxml file in iReport.

Plz help sir
takCare's picture
Joined: May 28 2008 - 4:09pm
Last seen: 5 years 11 months ago
Feedback