You are not logged in.

birosys

Trainee

  • "birosys" is male
  • "birosys" started this thread

Posts: 48

Date of registration: Feb 9th 2009

Location: Mladenovac, Serbia

Occupation: Programming

Hobbies: Programming

  • Send private message

1

Wednesday, September 16th 2009, 12:09am

JasperReport and Jabaco

Hello
Here is working sample of JasperReport, very powerful reporting engine.
You can use them for your database, or any other application, because data source can be a simple CSV file.
First download and setup iReport from JasperForge
After installation, create and define your report from iReport
After completing report, in Jabaco CLASSPATH add folowing jar files

C:\Program Files\Jaspersoft\iReport-nb-3.6.0\ireport\modules\ext\jasperreports-3.6.0.jar
C:\Program Files\Jaspersoft\iReport-nb-3.6.0\ireport\modules\ext\commons-beanutils-1.8.0.jar
C:\Program Files\Jaspersoft\iReport-nb-3.6.0\ireport\modules\ext\commons-collections-3.2.1.jar
C:\Program Files\Jaspersoft\iReport-nb-3.6.0\ireport\modules\ext\commons-digester-1.7.jar
C:\Program Files\Jaspersoft\iReport-nb-3.6.0\ireport\modules\ext\commons-logging-1.1.jar
C:\Program Files\Jaspersoft\iReport-nb-3.6.0\ireport\modules\ext\groovy-all-1.5.5.jar
(PS: Change path to your needs)

After that you can add reference for folowing class

JasperDesign, JRXmlLoader, JasperReport, JasperCompileManager,
JasperPrint, JasperFillManager, JasperViewer

and add Jabaco code

Jabaco Source

1
2
3
4
5
6
Dim jd As JasperDesign=JRXmlLoader.load("c:\Report1.jrxml") '''REPORT FILE
Dim jr As JasperReport=JasperCompileManager.compileReport(jd)
Dim db As New Database
db.ConnectDSN ("Test") '''DB CONNECTION
Dim jp As JasperPrint=JasperFillManager.fillReport(jr,Null,db.Connection)
JasperViewer.viewReport(jp,False)


That is all (for now)
Milan
birosys has attached the following image:
  • JasperJabaco.PNG

DragonWar13

Beginner

Posts: 5

Date of registration: Jan 13th 2011

  • Send private message

2

Saturday, January 22nd 2011, 4:26pm

Good Afternoon, I did everything as directed, downloaded, installed it, created the report, I added all the classes as reported, but could not make reference classes below JasperDesign, JRXmlLoader, JasperReport, JasperCompileManager,
JasperPrint, JasperFillManager, JasperViewer. When I run the jabaco JasperDesign says class not found what might be happening? thanks

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

3

Monday, January 24th 2011, 9:58pm

Hi,
the following compiles OK:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Option Explicit

' run "ant jar" to build the jasperreports jar files
' X:\jasperreports-4.0.0\dist\jasperreports-4.0.0.jar
'
' ..\Lib\*.jar are distributed with the download file
' X:\jasperreports-4.0.0\Lib\commons-beanutils-1.8.0.jar
' X:\jasperreports-4.0.0\Lib\commons-collections-2.1.1.jar
' X:\jasperreports-4.0.0\lib\commons-digester-1.7.jar
' X:\jasperreports-4.0.0\lib\commons-logging-1.0.4.jar
' X:\jasperreports-4.0.0\lib\groovy-all-1.7.5.jar

Import net#sf#jasperreports#engine#design#JasperDesign
Import net#sf#jasperreports#engine#xml#JRXmlLoader
Import net#sf#jasperreports#engine#JasperReport
Import net#sf#jasperreports#engine#JasperCompileManager
Import net#sf#jasperreports#engine#JasperPrint
Import net#sf#jasperreports#engine#JasperFillManager
Import net#sf#jasperreports#view#JasperViewer

Public Sub Command1_Click()
   Dim jd As JasperDesign = JRXmlLoader.load("y:\BarbecueReport.jrxml") '''REPORT FILE
   Dim jr As JasperReport = JasperCompileManager.compileReport(jd)
   Dim db As New Database
   
   db.ConnectDSN ("Test") '''DB CONNECTION
   Dim jp As JasperPrint = JasperFillManager.fillReport(jr,Null,db.Connection)
   JasperViewer.viewReport(jp,False)
End Sub


You have to use "Import" statements to tell Jabaco which classes you intend to use.
The project classpath is used to define the accessible *.jar files.
But the same class name might occur in more than one Jar file.

Happy experimenting!

A1880

Ronnie

Beginner

  • "Ronnie" is male

Posts: 10

Date of registration: Oct 11th 2012

Location: Florida

  • Send private message

4

Saturday, November 10th 2012, 2:46pm

Hi - I know the original question is old but it might help me solve a problem I am currently having. I am trying to use a Java report tool (Java4less RReport) and was wondering why the import statement in the example code uses the "#" and not a period in the import statement:

Why
Import net#sf#jasperreports#engine#design#JasperDesign


Not
Import net.sf.jasperreports.engine.design.JasperDesign


Txs... Ronnie

Rate this thread
WoltLab Burning Board