Sakura Hana Posted October 28, 2013 Share Posted October 28, 2013 Dear everyone!!!I am new to Jaspersoft.I was trying create bean datasource in iReport, but I get message like this:This is my java code: package com.source.myclass;public class barchart { private String Name; private double Number; public barchart(){}; public void setName(String n){this.Name=n;} public void setNumber(double n){this.Number=n;} public String getName(){return this.Name;} public double getNumber(){return this.Number;}}package com.source.main;import java.util.Collection;import java.util.HashSet;import java.util.Vector;import org.rosuda.JRI.REXP;import org.rosuda.JRI.Rengine;import com.source.myclass.barchart;public class RJAVA4 { public RJAVA4(){}; public static Collection<barchart> getBarchartData() throws Exception{ Vector<barchart> bars = new Vector<barchart>(); try{ Rengine engine = new Rengine(new String[]{"--no-save"}, false, null); REXP NameR = engine.eval("substring('ABCDEFGHIJ',1:10,1:10)"); REXP NumberR = engine.eval("rnorm(10)+100"); engine.end(); String[] STRING_NAME = NameR.asStringArray(); double[] NUMBER = NumberR.asDoubleArray(); barchart bar = null; for(int i=0;i<10;i++){ bar = new barchart(); bar.setName(STRING_NAME[i]); bar.setNumber(NUMBER[i]); bars.add(bar); } } catch(Exception e){ e.printStackTrace(); } return bars; } public static void main(String[] args) throws Exception { Collection<barchart> myCollection = new HashSet<barchart>(); myCollection = getBarchartData(); for(barchart element: myCollection){ System.out.println(element.getName() + "|||"+element.getNumber()); } }}[/code]Any helps? really appreciate. 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