Jump to content
JasperReports Library 7.0 is now available ×

Error loading class while using scriptlets in Jasper Studio


gowthamsenmca
Go to solution Solved by Massimo Rabbi,

Recommended Posts

Hi,

I am trying to use scriptlets in my report using Jasper Studio.

The java scriptlet class is working perfectly fine independently which is tested.

I added the classpath using window --> Preferences --> Java --> BuildingPath --> Classpath Variables

And I am referring the class using package. <packagename>.ScriptletName. I added this as a superclass for report properties.

But I am getting an error asfollows

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRException: Error loading scriptlet class :<scriptletname>

at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:482)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:457)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:347)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
 
Any help will be very useful.
 
Best Regards
Gowtham
Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

Hi,
there is no need to use the "Classpath Variables". If you are writing your own scriptlet class inside JSS, then you can add a new "Source Folder" and put it in there. If you are using a scriptlet class coming from a jar, then you should use the "Java Build Path > Libraries (tab)" and add a new (external, if outside workspace) jar.

Best regards,
Massimo.

P.S: if you are not familiar with the Eclipse environment, please give a look at some these sample articles that explains a bit the Java Build Path page.
- http://my.safaribooksonline.com/book/software-engineering-and-development/ide/0321288157/java-project-configuration/ch06lev1sec1
- http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-properties-build-path.htm

Link to comment
Share on other sites

Hi, 

can you please check that "Java Capabilities" are enabled? Verify it from "Window > Preferences > General > Capabilities > Development > Java Development".

 

Anyhow, I think I got it what are your steps. Therefore if you really want to use a USER LIBRARY, then from that Preference page "Window > Preferences > Java > Build Path > User Libraries", first of all click on "New" button in order to create a new definition. Then clicking on the definition itself you will see that the "Add External JARs" button is enabled. Look at the two screenshots: scriptlets_USERLIBRARY_1.png and scriptlets_USERLIBRARY_2.png.

It will show the steps and how to use them later in your JasperReports Project.

 

Another option, as I said in the previous reply is to use directly the Java Build Path properties page of your project and add the external jar from there.

See the other screenshot attached.

It's up to you. 

 

Hope that this solves your doubts.

Best regards,

Massimo.

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