Hello World Scriptlet Example:Error "cannot be resolved to a type"

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.

I am trying to follow the tutorial Hello World Scriptlet Example by Sadakar Pochampalli.

After following all the instructions, once i try to compile and run the report i get the error below.

Help greatly appreciated!!

    net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
    1. com.sadakar.jasper.Test4 cannot be resolved to a type
                value = ((com.sadakar.jasper.Test4)parameter_Hello_SCRIPTLET.getValue()).hello(); //$JR_EXPR_ID=8$
    2. com.sadakar.jasper.Test4 cannot be resolved to a type
                value = ((com.sadakar.jasper.Test4)parameter_Hello_SCRIPTLET.getValue()).hello(); //$JR_EXPR_ID=8$
    3. com.sadakar.jasper.Test4 cannot be resolved to a type
                value = ((com.sadakar.jasper.Test4)parameter_Hello_SCRIPTLET.getValue()).hello(); //$JR_EXPR_ID=8$
    3 errors
        at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:206)
        at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:294)
        at com.jaspersoft.studio.editor.preview.view.control.ReportControler.compileJasperDesign(ReportControler.java:465)
        at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$15(ReportControler.java:442)
        at com.jaspersoft.studio.editor.preview.view.control.ReportControler$5.run(ReportControler.java:356)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

dstevens_2's picture
Joined: Jun 20 2017 - 8:32am
Last seen: 2 years 7 months ago

7 Answers:

Theres a nice tutorial video on scriptlets "TIBCO Jaspersoft: Using Scriptlets inside TIBCO Jaspersoft Studio and JasperReports"


Maybe this can help you determine where it went wrong.

vchiem's picture
Joined: May 1 2017 - 5:33pm
Last seen: 4 days 21 hours ago

Thank you for the swift response.

I think the problem is configuring my jar files, and this particular tutorial doesn't cover that part.

If you have any good references for the configuration step I'd greatly appreciate that.

dstevens_2's picture
Joined: Jun 20 2017 - 8:32am
Last seen: 2 years 7 months ago

I remembered getting issues following this example too... whether or not its exactly this error but I think it was similar. 

I believe there's a mistake in one of the steps.. 

3) Add Jasper Server jar file to Project Path

This step applies to the Java project.. The jar file mentioned is 'Jar File Name : jasperreports-pro-6.0.0.jar' but this is not right. It should be jasperreports-6.3.0.jar (for 6.3) or  jasperreports-6.2.0.jar as per the screenshot in the following step. 

As my Studio is not where the server is, I copied the  jasperreports-6.3.0.jar from server and place it locally and load that in the project path. 

Step 5 and 6a are important. Once you have exported your test.jar, step 6a should be done for "MyReports" not for the java project.

vchiem's picture
Joined: May 1 2017 - 5:33pm
Last seen: 4 days 21 hours ago

I had the same problem dstevens_2, I restarted my Jaspersoft studio and eveything worked fine ! 


arnaudsimon091's picture
Joined: Nov 26 2018 - 12:25pm
Last seen: 3 weeks 13 hours ago


vchiem u should remove that video, having a .java in the build path simply doesn't work, that's a big lie, we all have the same error XXX cannot be resolved to a type 

firuzzz's picture
Joined: May 17 2012 - 5:03am
Last seen: 4 months 3 weeks ago

I was tearing my hair out over this as well.  In my case, the problem was that it simply doesn't work in Jaspersoft Studio (Community Edition) 6.17.0, and reverting to 6.16.0 fixed it.  I don't know if this is the same bug mentioned for the Enterprise edition version 7.3.1: https://community.jaspersoft.com/wiki/scriplet-class-cannot-be-resolved-...

Also, a slight update to Sadakar Pochampalli's instructions... step 6a should now read:

Right Click on "My Reports" Project -> Build Path -> Configure Build Path -> Libraries -> Classpath -> Add External JARs ->("test" jar from your exported location from Eclipse) -> Apply and close

martinquested's picture
Joined: Dec 14 2020 - 1:23am
Last seen: 1 year 3 weeks ago

Windows 6.5.1 - Works

MacOs 6.16.0 - Not work

MacOs 6.17.0 - Not work


TRANSLATE.JAR loaded (just like in windows)


dunham's picture
Joined: Oct 18 2013 - 6:57am
Last seen: 2 months 3 weeks ago