problem in import package in birt script
I write below code in script .
importPackage( Packages.java.io );
importPackage(Packages.java.text.SimpleDateFormat);
outFile = new FileWriter("../sandfilelogtoday.txt");
out = new PrintWriter(outFile);
sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss:ms");
out.println(sdf.format(new Date()).toString()+"-- intializern");
out.close();
when i run this report it will get below error
ReportDesign (id = 1):
- Unhandled exception when executing script.
Caused by: org.eclipse.birt.core.exception.CoreException:
There are errors evaluating script "importPackage( Packages.java.io );importPackage(Packages.java.text.SimpleDateFormat);outFile = new FileWriter("../sandfilelogtoday.txt");out = new PrintWriter(outFile);sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss:ms");out.println(sdf.format(new Date()).toString()+"-- intializern");out.close();"
Function importPackage must be called with a package; had "[JavaClass java.text.SimpleDateFormat]" instead. (/report/method[@name="initialize"]#2).
what should i do, please help soon
sandeep
Comments
-
Hi sandeep,
Remove SimpleDateFormat from your importPackage statement since it is not a Package. That line should look like:
importPackage( Packages.java.text );
I created a working example with BIRT 2.3.0 enclosedWarning No formatter is installed for the format ipb0 -
There are 2 java files under src/test folder.
Test.java and Test2.java. I'm able to invoke the method from both classes.
My rptdesign file is one level higher than this. Its in /package folder.
I'm unable to invoke the Test2.java from rptdesign file.
Also, there is no error when i give this statement in Script.
importPackage (Packages.src.test)
What could be wrong. Pls, help soon.0 -
Hi everybody,
I had a similar issue.
I create a jar Called QrCodeGenerator_rev20220729 and I put it in birt with this way:
Window -> Preferences -> Report Design -> Classpath -> Add External Jars
I script :
importPackage( Packages.qrCodeGenerator.* );
vars["qrCode"] = QrCodeGenerator.getQRCodeIme(this.getRowData().getColumnValue("code"), 50, 50);
But birt gave me back that error:
There are errors evaluating script "importPackage( Packages.qrCodeGenerator.* );
vars["qrCode"] = QrCodeGenerator.getQRCodeIme(this.getRowData().getColumnValue("code"), 50, 50);":
ReferenceError: "QrCodeGenerator" is not defined.
The Jar is structured:
QrCodeGenerator_rev20220729 as jar / qrCodeGenerator as package / QrCodeGenerator.class as class
I'm really new about external jar with BIRT how can i solve it?
You can find jar file (as zip file) attached.
Hope hear you soon,
Best regards
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 150 General Questions
- 148 Thrust Services
- 57 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories