Samira Khorshidi
Samira Khorshidi

Reputation: 942

How to use external JAR file in JasperSoft Studio

I have project in iReport, I want to build this in jasper studio,in that I use some external jar file to convert date, but in jasper studio I cant use them, I add those jar file in right click on project folder > properties > java build path > libraries > add External JARs.., I get error when I want to see report preview :

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. com.ghasemkiani.util.icu.PersianDateFormat cannot be resolved to a type
                value = new com.ghasemkiani.util.icu.PersianDateFormat("yyyy/MM/dd").format(((java.sql.Timestamp)field_ORDERDATE.getValue())); //$JR_EXPR_ID=9$
                            <---------------------------------------->
2. com.ghasemkiani.util.icu.PersianDateFormat cannot be resolved to a type
                value = new com.ghasemkiani.util.icu.PersianDateFormat("yyyy/MM/dd").format(((java.sql.Timestamp)field_ORDERDATE.getOldValue())); //$JR_EXPR_ID=9$
                            <----------------------------------------> 

so,my question is : how can I add external jar file and use it?

Upvotes: 3

Views: 30256

Answers (4)

EA0906
EA0906

Reputation: 482

After you have added jar file to build path you have to restart your Jasper Studio.

Upvotes: 9

Rajesh Sirsikar
Rajesh Sirsikar

Reputation: 21

You have added the JAR file in the right location, but the issue (looking at the error message) is that the reference to the external class has not been provided.

Select the Field or Variable which needs to be run the new class (from JAR file). change the Class of the fields to your new class and run the report. You will have no errors then.

Upvotes: 2

BigAl
BigAl

Reputation: 313

'In Jaspersoft Studio there is no longer a big unique classpath for the whole application like in iReport.

Each report is supposed to be part of a project. The project has a classpath, and here is where you should add the jars you need.

All is done by opening the projects view and right click the project folder with which you are working on. By default, new reports are created in the project "My Reports".'

Answer From JasperCommunity

Upvotes: 2

Vimal Bera
Vimal Bera

Reputation: 10497

In order to get the JRXML attached working what you will need to do is

Import the jar Tools(in the iReport Menu bar )-----> Options ----- > Click on Claspath Tab ------> ADD Jar -----> choose the JAr file (I Think You missed this step You need to import the JAR file through iReport through the above described process, no need of using IDE for classpath setting use iReport only)

It works for me.

Upvotes: 1

Related Questions