How to remove compiler dependency

By: Bertrand Fontaine - fontaineb
How to remove compiler dependency
2002-11-12 01:39
To produce a ".jasper", Jasper generates some Java code. In order to compile this code, either javac or tools.jar must be available. This is problematic:

a) javac is not available to the end users of my application as far as they have a JRE installed and not a JDK

b) distributing tools.jar is - I think - not in-line with license conditions from SUN. Also, tools.jar is several Mb what would make distribution of my application via the Internet much less viable

I would like to know if there is some way to remove dependency on compilation, even if this implies losing some features (to be identified).

Thank you!

By: Martin Phee - mphee
RE: How to remove compiler dependency
2002-11-12 10:15
Just include the .jasper files. Don't include the xml files, and don't recompile them.

By: Teodor Danciu - teodord
RE: How to remove compiler dependency
2002-11-12 12:26


Martin is right.
You only have to supply your users with the
.jasper files, just like you supply them with
the .class files of your application and not with
the Java source files.

However, if your application dynamically creates
report templates that it compiles on the fly,
then indeed you have a problem.

But support for other compilers was already
introduced on the CVS repository
at and will be part of the next
Using the "jasper.reports.compiler" system
property you can set a different Java compiler
to use in your application. For example, jikes.
It does not require a JDK installation on the
machine, only the JRE and the license terms might
suit you.

There is also the possibility of introducing
Bean Shell in JasperReports, but I think this
is more like a long shot these days.

Thank you,

By: JC Tchitchiama - jeanch
RE: How to remove compiler dependency
2002-11-13 11:27
I am in the same position as bertrand. We're not planning to have a java compiler on the target machine and we want template to be handled by the user. So same issue.
Teodor has you thought about using velocity. I am by no means a velocity expert but for what I read it could give us a means for creating templates on the fly run the templates thru a velocity parser and load the "data" in a java code.
Sorry if I am wrong


By: Teodor Danciu - teodord
RE: How to remove compiler dependency
2002-11-13 13:02


Lately, I came to think that the jikes solution
is the best, at least for the moment.
Your client already has JRE installed, otherwise
he or she cannot run the application you made for
him or her.
Then you only have to copy jikes.exe on the target
machine and dynamic reports are available.
And this is something you could do starting today,
if you get the latest JasperReports version from
the CVS repository.

As for adapting JasperReports to "velocity"
or "bean shell" or other libraries that would help
run java code dynamically, this could take months
to implement, in case they will be done.

Thank you,

By: Bertrand Fontaine - fontaineb
RE: How to remove compiler dependency
2002-11-13 01:04
Typically, the end user would have the possibility to select in a table which columns to display in the report, and eventually the order in which the columns should appear. I was planning not to use XML for the definition of the report but the API, like in the "noxmldesign" example. Does it sound feasible to write a JRCalculator "by hand" that can handle this type of report? Of course, JasperReports would have to be adapted to handle this. An idea could be to slightly modify JRClassGenerator.generateClass(JasperDesign) to directly return the ".class" when it is already available. What do you think?

By: Teodor Danciu - teodord
RE: How to remove compiler dependency
2002-11-13 13:33


Never thought of that before.
I'll think about it.

Thank you,

By: Maciej Kaminski - maciejka
RE: How to remove compiler dependency
2002-11-14 07:26
There is the Dynamic java at:
and Pizza (java superset) compiler at:
2001 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:26am
Last seen: 16 years 9 months ago

0 Answers:

No answers yet