Jump to content
We've recently updated our Privacy Statement, available here ×

[Scriptlet] - need a little help and an How to.... if possible


thegg

Recommended Posts

Hi all, and thanks by advance for your help...

I'm elaborating a report with ireport 4.0 and I need to do a scriptlet.

My java skill isn't very good and I passed 2 days to turn around the subject on this forum and others but... that doesn't work...

 

1 - The downloaded scriptlet sample, don't work ! I have put the tools.jar in the 4.0 directory lib and in the classpath.. But designer still indicate a java.lang exception on a style object ... :(

2- I have installed the ultimate netbeans+java pack and now how I can integrate the jasper lib to this IDE ? Because I want to create a special library to get out my scriptlet problems...

 

Thx

 

(Edit) PS : I have seen littles words about a scriptlet editors (old version) and a netbeans plugin about scriptlet any complementary news ?

TheGG

Ireport 4.0 - NetBeans 6.9.1 - JDK 1.6 - (JasperReport 4.0 in a corner of my disk)



Post Edited by thegg at 02/17/2011 17:09



Post Edited by thegg at 02/17/2011 17:18
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

ok, I had need one more day and a night  to help me to resolve the second part of  my problem.

So

1 : I taking the plugin for netbean and installed it by the netbeans plugin interface.

2 : downloaded the jasper 4.0.0 and installed on a library (api folder, doc folder, lib/comon*.jar and jasper*.jar)

3 : tested to build a class with JRDefaultscriptlet and JRScriptletException and a public fonction returning a simple string.

The build don't up error so I consider that 's ok

But in the report...  Continue to didn't work

I proved to :

  • add my class jar into the ireport lib
  • add my class jar into the classpath list
  • add my class jar into the same directory of the jrxml

Thx per advance to your advice.

Link to comment
Share on other sites

Hi all, I think I turn around a mistake but I don't find any clues.

So here the class :

 

Uds4LibScriptlet.class


package uds4ireport;

import net.sf.jasperreports.engine.JRDefaultScriptlet;
//import net.sf.jasperreports.engine.JRAbstractScriptlet;
//import net.sf.jasperreports.engine.JRScriptletException;

public class Uds4LibScriptlet extends JRDefaultScriptlet
{
    public String GetImagePath(String Field)
    {
            return "foo string";
    }
}

 

In the properties of my jrxml  :


scriplet class = Uds4LibScriptlet

language=java

Imports=uds4ireport

 

classpath of ireport options :


<javapath>JDK1.6.0_23\lib

<javapath>JDK1.6.0_23\bin

<javapath>JDK1.6.0_23\lib\tools.jar

<ireport-4.0path>\libs\tools.jar

<jasper4.0path>\dist\jasperreports-4.0.0.jar

<path of my package>\dist\uds4ireport.jar

 

in the jrxml I have only a field with :


$P{REPORT_SCRIPTLET}.GetImagePath("")

result :

java.lang.classNotFoundException: Will not load classes from default package (Uds4LibScriptlet) in styles Object...

If I copy-past my Uds4LibScriptlet.class in the jrxml directory I don't have anymore the message but the preview do nothing :(.

 

Where I have wrong please ?

 

Thx for your future advices

 

The GG

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...