Jump to content
JasperReports Library 7.0 is now available ×

How to access javabeans datasource in iReports?


Recommended Posts

I am pretty new to iReports, but I need to create several reports using Javabeans as the datasource.

I found this reference:


In this, the author mentions that he created a jar file of the classes and placed that jar file in the "lib" directory. After doing that, he was able to access the bean properties from within iReport.  This is where he lost me.

Can anyone fill me in on details of how I might access the classes of a NetBeans project in iReport 4.5.0 (or something similar).

I have both the stand-alone version and the NetBeans plugin, but have not been able to figure out how to access the bean properties in the iReport framework.


Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic


As the reference says, you need to add the jar with the bean classes to the lib directory. I understand you have two different options:

  • For doing that in iReport, go to "Tools-> Options". Then select CLASSPATH tab and you can add the jar from here.
  • If you want to create the report in Netbeans using the iReport plugin is a little bit different. You have to go to "Tools->Options->iReport" and then select the CLASSPATH tab and add the needed jar.

Hope this helps.


Link to comment
Share on other sites

Thanks for the feedback.

With the Netbeans module, is there any way to have it reference my source code package, or do I still need to create a jar file for that package?

I have two packages that need to be accessed - one with the database references and the other with the bean wrappers that access the database references.  Would I  be able to add more than one jar file in the classpath?

One other option that I have seen is to use a Hibernate data source.  I am using hibernate, but have not figured out how to use that as a datasource.  Any suggestion on how I can make that connection in the Netbeans plugin?  Netbeans has the all the hibernate info.  Can iReport link in to that?

Link to comment
Share on other sites

  • 4 years later...

Though the question is too older, And I hope you already solved the same,  but it is surely a wounded horse many person are facing the same issue. 

So I am going to post my way I used to get rid of it.


1. go to "Tools->Options->iReport" and then select the CLASSPATH tab

2. click on 'Add Folder' the select the directory contains classes (eg:- "ProjectPathtargetclasses") 

3. Click OK, You are done with class path now.

4. click on add DataSource Button from the top header buttons. A window will gets open.

5. Click on "New" on the right PAN of the last window.

6. Choose JavaBeans set datasource, click next.

7. enter any name you want to give to your datasource.

8. In the factory class option enter the fully qualified class path of your bean (eg: com.jasper.bean.BeanClass) 

9. Select the radio button (Either a Collection/ ArrayList depending on your bean retreiving method)

10. In The static method area give the name of the retreivaial method (eg:- listAllBean)

11. click on 'Test'

12. If you are succeed click on SAVE.

Hope it helps. 


Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...