Naxi
Naxi

Reputation: 2044

Not able to reference Java class from my report in BIRT

I am very new to BIRT. I am wokring on a BIRT project where I am trying to reference Java class inside script 'open' section but am unable to do so.

I do not get any errors but I am not able to see any data in my dataset preview.

Project Structure

Script - open

count = 0;

// create instance of
// the GetStockHistory class
gsh = new Packages.de.vogella.birt.stocks.daomock.StockDaoMock(); //cause of error somehow

//Load the List

stock = gsh.getStockValues("Java");

Script-Fetch

if(count < stock.size()){
       row["columnDate"] = stock.get(count).getDate();
       row["columnOpen"] = stock.get(count).getOpen();
       row["columnHigh"] = stock.get(count).getHigh();
       row["columnLow"] = stock.get(count).getLow();
       row["columnClose"] = stock.get(count).getClose();
       row["columnVolume"] = stock.get(count).getVolume();
       count++;
       return true;
}

return false;

StockDaoMock is a class which returns a dummy list of values. Referring this blog BIRT sample app

Can anyone please help me here and let me know what am I doing wrong ? Why can't I see any data in preview dataset. Is there a specific way in which I need to make reference to java classes because I am sure the error is somewhere in that part only. If I remove the reference part and just hardcode a string, then it is working fine and I can see it in the preview. Things mess up as soon as I refer a java class by importing it.

BIRT-4.8

EDIT---

even this inside my Script 'open' doesn't work

importPackage(Packages.de.vogella.birt.stocks.daomock);
gsh = new StockDaoMock();

Upvotes: 0

Views: 886

Answers (1)

hvb
hvb

Reputation: 2668

BIRT does not use the java sources directly. You have to generate a JAR from your classes and add that JAR to your BIRT class path (Window / Preferences / Report Design / Classpath).

Upvotes: 1

Related Questions