Search code examples
jasper-reports

cannot be resolved to a Type Jaspersoft Studio


Using jaspersoft Studio 6.1.1

What i'm trying to achieve is to transform the numbers i get to the Roman format, and for that i added a .jar that i created to do the job, the problem is, when i'm trying to use the functions in my .jar, i get the errors below:

    net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. RomanNumeral.roman cannot be resolved to a type
                value = new RomanNumeral.roman(1); //$JR_EXPR_ID=8$
                            <---------------->
2. RomanNumeral.roman cannot be resolved to a type
                value = new RomanNumeral.roman(1); //$JR_EXPR_ID=8$
                            <---------------->
3. RomanNumeral.roman cannot be resolved to a type
                value = new RomanNumeral.roman(1); //$JR_EXPR_ID=8$
                            <---------------->
3 errors

RomanNumeral is the name is the .jar and the class.

I looked everywhere for a similar error and that didn't help

any idea why this happens?


Solution

  • i could fix my problem, if someone have the same problem, i hope this can help them.

    After you add the .jar to your java build path of your project, you have to import it to the report you want to use.

    libraries

    import it to your report

    Then, to use the functions in your .jar, i had to write the path of the function like this "package.Class.Method", in my case for example was:

    com.certuit.utils.RomanNumeral.roman(1)

    com.certuit.utils is the package.

    RomanNumeral the class

    roman(1) is the method i want to use

    This is what worked for me.