Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to import User Defined Class in Report
SiddamS
Hi All,
I have a requirement like created a Jar File.I need to import that Jar file into Report Project.I have to used that in Java script function of component of Report.
For Example :- Created Java file as follows :-
public class MYLIB {
public String returnLib()
{
return "HELLO";
}
}
I need to call "returnLib()" Method in Java script Event of Text component.
Could you please help me.
Thanks and Regards
Swetha.
Find more posts tagged with
Comments
SiddamS
Please help for me.......
CBR
First you have to ensure that this Java class is in the classpath of the java process that runs the report.
When designing the report that means that the java class and your report have to be in the same eclipse project. If they are in different projects your report won't be able to find the java class.
If they are in the same project you can do some scripting with it. You have to keep in mind some rhino script "specials" like the package adressing of java classes. For your self written java class you have to add the word "Packages" when trying to reach the class inside a rhino script expression
e.g.:
i assume that the Java class MyLib is placed in the java package org.example
so you can reach it with the following RhinoScript expression
var javaObject = new Packages.org.example.MyLib()
now javaObject contains a instance of a java object of type MyLib
you can then work with it in rhino script
e.g.
call javaObject.returnLib() inside rhino script
SiddamS
Acually I need to import my Java Class file (Jar file) into my report project.
Generally how can we import the Predined Libraries(Jars) into report project.
Thanks and Regards
Swetha.
mwilliams
Hi Swetha,
Are you trying to get a class file to work with the designer or when deployed? Or both?
SiddamS
both ....
Thanks and Regards
Swetha.
mwilliams
Swetha,
When you say "user defined class", do you mean they have their own class they want to import or they choose from a parameter list of classes you already have or something different?
SiddamS
They have a their own class(given jar file),I need to use that class in My Javascript Event.
mwilliams
Swetha,
But you have a copy of the class file to deploy out to your server? It just depends on which user which function you need to use?