I want to add Barcode font39 to my JR report. As given in the JasperReports tutorial, I have packed my fonts.xml, .ttf and the jasperreports_extension.properties in a jar and included this jar in classpath.
My fonts.xml content is as:
<fontFamilies>
<fontFamily name="Barcode">
<normal>net/sf/jasperreports/fonts/barcode/ConnectCode39_S3_Trial.ttf</normal>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
</fontFamily>
</fontFamilies>
The jasperreports_extension.properties file:
net.sf.jasperreports.extension.registry.factory.simple.font.families=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
net.sf.jasperreports.extension.simple.font.families.myFamily=net/sf/jasperreports/fonts/fonts.xml
However when run, I get the following exception:
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:121)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:87)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:57)
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:142)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:52)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
at Report.Test.main(Test.java:213)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Input stream not found at : net/sf/jasperreports/fonts/fonts.xml
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:156)
at net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.getExtensions(FontExtensionsRegistry.java:55)
at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensions(DefaultExtensionsRegistry.java:110)
at net.sf.jasperreports.engine.util.JRStyledTextParser.<clinit>(JRStyledTextParser.java:83)
... 8 more
Caused by: net.sf.jasperreports.engine.JRException: Input stream not found at : net/sf/jasperreports/fonts/fonts.xml
at net.sf.jasperreports.repo.RepositoryUtil.getInputStream(RepositoryUtil.java:169)
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:151)
... 11 more
What am I doing wrong?