gowthamsenmca Posted November 20, 2013 Share Posted November 20, 2013 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 VariablesAnd I am referring the class using package. <packagename>.ScriptletName. I added this as a superclass for report properties.But I am getting an error asfollowsnet.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 RegardsGowtham Link to comment Share on other sites More sharing options...
Solution Massimo Rabbi Posted November 20, 2013 Solution Share Posted November 20, 2013 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 More sharing options...
gowthamsenmca Posted November 20, 2013 Author Share Posted November 20, 2013 Hi, I tried to add jar file using "Add external Jar". But this option is disabled. I can see only "New" and "Import" options in enabled. Please suggest! Thank you Link to comment Share on other sites More sharing options...
gowthamsenmca Posted November 20, 2013 Author Share Posted November 20, 2013 The scriptlets are working when placing the Java class and the report in the same project. If both are in different projects, as you mentioned we need to add the jar file using the above mentioned method. But the option you have mention is disabled. Link to comment Share on other sites More sharing options...
Massimo Rabbi Posted November 21, 2013 Share Posted November 21, 2013 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now