Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Importing .jar files into BIRT(Can not seem to load .jar files into BIRT)
Importing .jar files into BIRT [message #803330] Tue, 21 February 2012 07:43 Go to next message
andrew smith is currently offline andrew smithFriend
Messages: 43
Registered: February 2012
Member
Hi, all:

I hope this post finds you all well. What is the best way to include .jar files into BIRT project thus making its classes visible to the scipt?

I have some logic contained in Java .jar files ie bunch of data processing classes that I would like to invoke through BIRT. They all work flawlessly in Java. I ran them in pure Java, Matlab, Netbeans, etc.

I use the importPackage command:
importPackage(Packages.database.connectors.jdbc.MsSQLserver);

however, I get the following message:

Function importPackage must be called with a package; had "[JavaClass database.connectors.jdbc.MsSQLserver]" instead. (/report/method[@name="initialize"]#1)

I added .jar file already as an external JAR (ProjectProperies->Classpath ). Also I tried sticking it in the /WEB-INF/lib folder as well as using the Import Wizard. Same error prevails...

What am I doing wrong?

Thank you,
Andrew
Re: Importing .jar files into BIRT [message #803695 is a reply to message #803330] Tue, 21 February 2012 17:06 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Take a look at this:
http://birtworld.blogspot.com/2009/12/birt-designer-classpath-changes.html
That post shows the preference to use in the designer. You can also
click on resources for the report and add a jar there, but the jar will
have to be available in the resource folder in the designer and deployed
viewer

If you added the jar to the designer classpath,
when you deploy the report to the viewer (3.7 or >) just put the jar in
the web-inf/lib.

Jason

On 2/21/2012 2:43 AM, andrew smith wrote:
> Hi, all:
>
> I hope this post finds you all well. What is the best way to include
> .jar files into BIRT project thus making its classes visible to the scipt?
> I have some logic contained in Java .jar files ie bunch of data
> processing classes that I would like to invoke through BIRT. They all
> work flawlessly in Java. I ran them in pure Java, Matlab, Netbeans, etc.
>
> I use the importPackage command:
> importPackage(Packages.database.connectors.jdbc.MsSQLserver);
>
> however, I get the following message:
>
> Function importPackage must be called with a package; had "[JavaClass
> database.connectors.jdbc.MsSQLserver]" instead.
> (/report/method[@name="initialize"]#1)
>
> I added .jar file already as an external JAR
> (ProjectProperies->Classpath ). Also I tried sticking it in the
> /WEB-INF/lib folder as well as using the Import Wizard. Same error
> prevails...
>
> What am I doing wrong?
>
> Thank you,
> Andrew
Re: Importing .jar files into BIRT [message #803870 is a reply to message #803695] Tue, 21 February 2012 23:28 Go to previous messageGo to next message
andrew smith is currently offline andrew smithFriend
Messages: 43
Registered: February 2012
Member
Hello Jason,

Thank you for your advice. Let me go over the items just to make sure I understand

1) Followed the instructions at birtworld.blogspot.com/2009/12/birt-designer-classpath-changes.html. I created a custom folder for all of my .jar files and placed the path to the folder using the PROJECT PROPERTIES->CLASSPATH
Result: the class is not being imported

2) I placed the .jar file directly into the /WEB-INF/lib folder.
Result: the class is not being imported

3) Imported .jar file through the resources window.
Result: the class is not being imported

I am almost certain that the error that I am making is so trivial, that I can not seem to find it.
Is there a 'sure' way to import java classes into BIRT? What am I doing wrong?

Thanks,
Andrew
Re: Importing .jar files into BIRT [message #803906 is a reply to message #803870] Wed, 22 February 2012 00:45 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Adding a class folder only works for folders that contain classes not
jars I believe. Take a look at the attached workspace. Unzip it and
open the workspace in Eclipse. I have two projects in it that show how
to include a simple jar with the following code:

package my.simple.example;

public class TestClass {
private String testString="My String";

public String getTestString() {
return testString;
}

public void setTestString(String testString) {
this.testString = testString;
}
}

When you look at the preferences be sure to click on the configure
project specific configuration link. One shows how to include the jar
using the classpath preference and the other shows how to include a jar
in the resource folder.

Jason

On 2/21/2012 6:28 PM, andrew smith wrote:
> Hello Jason,
> Thank you for your advice. Let me go over the items just to make sure I
> understand
>
> 1) Followed the instructions at
> birtworld.blogspot.com/2009/12/birt-designer-classpath-changes.html. I
> created a custom folder for all of my .jar files and placed the path to
> the folder using the PROJECT PROPERTIES->CLASSPATH
> Result: the class is not being imported
>
> 2) I placed the .jar file directly into the /WEB-INF/lib folder.
> Result: the class is not being imported
>
> 3) Imported .jar file through the resources window.
> Result: the class is not being imported
>
> I am almost certain that the error that I am making is so trivial, that
> I can not seem to find it. Is there a 'sure' way to import java classes
> into BIRT? What am I doing wrong?
> Thanks,
> Andrew
Re: Importing .jar files into BIRT [message #804075 is a reply to message #803906] Wed, 22 February 2012 06:55 Go to previous message
andrew smith is currently offline andrew smithFriend
Messages: 43
Registered: February 2012
Member
Jason,

Thank you VERY MUCH for an example!! I found my error!! Stupid me, I was importing .jar file incorrectly.
Instead of importing a package and then using a class from there, I was importing the class directly. When I corrected my mistake, things started to work. Smile
If you are in Chicago, let me know. Beer is on me.

Many thanks!!
Previous Topic:Data set from SCTM
Next Topic:dynamic hyperlinking in birt 3.7.1.v20110905-809u7NFT0z0-TWCm5MjN7w
Goto Forum:
  


Current Time: Wed Apr 24 17:48:12 GMT 2024

Powered by FUDForum. Page generated in 0.02670 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top