<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: How to avoid NullPointerException with Crystal Report... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/14098949#M4913625</link>
    <description>&lt;P&gt;unfortunately since CR4E SP30 the System-Property SystemFontPath was removed.&lt;/P&gt;&lt;P&gt;Instead /etc/fonts/fonts.conf is parsed and all &amp;lt;dir&amp;gt; entries will be used as font-directories.&lt;/P&gt;&lt;P&gt;But since the font-configuration also supports entries in /etc/fonts/conf.d/ all separate configurations are ignored!&lt;/P&gt;&lt;P&gt;The only workaround with the new versions is to copy the ttf-files directly into /usr/share/fonts because this is the default-directory configured in fonts.conf.&lt;/P&gt;</description>
    <pubDate>Mon, 12 May 2025 10:37:19 GMT</pubDate>
    <dc:creator>c4u_mkoch</dc:creator>
    <dc:date>2025-05-12T10:37:19Z</dc:date>
    <item>
      <title>How to avoid NullPointerException with Crystal Reports Java-Libraries on Linux with OpenJDK?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaq-p/13728522</link>
      <description>&lt;P&gt;If you use the java libraries on linux with an OpenJDK (e.g. Eclipse Adoptium) and export a report as PDF you'll get a NullPointerException.&lt;/P&gt;&lt;P&gt;One &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;workaround&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; is to copy all needed fonts in the openjdk into jre/lib/fonts or lib/fonts (depending on the version) - but you have to do this manually after every java update.&lt;/P&gt;&lt;P&gt;This happens on alle linux-systems I've tested so far (Ubuntu, Debian, RedHat, Oracle, ...)&lt;BR /&gt;All distros have already a folder with fonts and if also Java knows the installed fonts.&lt;/P&gt;&lt;LI-CODE lang="java"&gt;    for (final String _f 
        : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames())
      System.out.println(_f);&lt;/LI-CODE&gt;&lt;P&gt;IMO this is a bug or hardcoded path somewhere in the crystal reports libraries.&lt;/P&gt;&lt;P&gt;Or does anybody know a fix for this problem? E.g. setting a system-property to the font-directory to use, call some kind of method to configure the path or do some magic on the system itself?&lt;/P&gt;&lt;P&gt;Unfortunately using symlinks also do not work (neither for files or folders) - afaik you have to copy all ttf-Files in the mentioned folder.&lt;/P&gt;&lt;P&gt;This is the Exception you get with a default OpenJDK:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;detected an exception: java.lang.NullPointerException
	at com.crystaldecisions.reports.exporters.format.page.pdf.fontembedding.opentype.tables.OS2Table.&amp;lt;init&amp;gt;(SourceFile:108)
	at com.crystaldecisions.reports.exporters.format.page.pdf.fontembedding.FontEmbeddingSession.if(SourceFile:116)
	at com.crystaldecisions.reports.exporters.format.page.pdf.fontembedding.FontEmbeddingSession.a(SourceFile:104)
	at com.crystaldecisions.reports.exporters.format.page.pdf.pdflib.r.if(SourceFile:594)
	at com.crystaldecisions.reports.exporters.format.page.pdf.pdflib.r.a(SourceFile:424)
	at com.crystaldecisions.reports.exporters.format.page.pdf.pdflib.PdfDocumentManager.a(SourceFile:337)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:1584)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:1492)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:780)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:729)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.a(SourceFile:683)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.a.if(SourceFile:633)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.a(SourceFile:1951)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.a(SourceFile:447)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.byte(SourceFile:323)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.a(SourceFile:303)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.d.a(SourceFile:283)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.b.a(SourceFile:217)
	at com.crystaldecisions.reports.exporters.format.page.pdf.dom.PdfAdvancedDocumentModeller.a(SourceFile:177)
	at com.crystaldecisions.reports.exporters.page.pdf.AdobePDFExporter.a(SourceFile:252)
	at com.crystaldecisions.reports.exporters.page.pdf.AdobePDFExporter.processFormattedContent(SourceFile:200)
	at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:105)
	at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:253)
	at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.if(SourceFile:647)
	at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.a(SourceFile:597)
	at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.a(SourceFile:641)
	at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.int(SourceFile:666)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1944)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:661)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:167)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:529)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:526)
	at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:525)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:424)
	at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:352)
	at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54)
	at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67)
	at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716)
	at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125)
	at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537)
	at com.crystaldecisions.sdk.occa.report.application.dt.a(SourceFile:186)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:1558)
	at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:337)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:224)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:206)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:184)
	at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:167)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 15:04:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaq-p/13728522</guid>
      <dc:creator>c4u_mkoch</dc:creator>
      <dc:date>2024-06-12T15:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid NullPointerException with Crystal Report...</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/13755323#M4836130</link>
      <description>&lt;P&gt;Yes, the directory where Crystal is taking the fonts from seems to be hardcoded to java.home\lib\fonts.&lt;/P&gt;&lt;P&gt;I found the following snippet in the source code of the fontembedding.class of Cystal Reports.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;    public static Map&amp;lt;String, OpenTypeFontFamily&amp;gt; if() {
        StringBuilder stringBuilder = new StringBuilder();
        String string = System.getProperty("java.home");
        if (!string.endsWith(File.separator)) {
            stringBuilder.append(string).append(File.separator).append("lib").append(File.separator).append("fonts");
        } else {
            stringBuilder.append(string).append("lib").append(File.separator).append("fonts");
        }
        Map&amp;lt;String, OpenTypeFontFamily&amp;gt; map = b.a(new File(stringBuilder.toString()));
        return map;
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Such hardcoded paths always brings the risk for the reports not to work properly when deployed on a new machine that might have those fonts installed in other directories like /usr/share/fonts/. Nowadays JRE will pick the fonts automatically. This should not be hardcoded from my point of view.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 07:54:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/13755323#M4836130</guid>
      <dc:creator>Martin_Zwernemann</dc:creator>
      <dc:date>2024-07-09T07:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid NullPointerException with Crystal Report...</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/13755744#M4836189</link>
      <description>&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;thank you for the hint - I've already checked the stacktrace multiple times but with your hint I found a much better workaround to this issue.&lt;BR /&gt;The class contains also a method do() where&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;System.getProperty("SystemFontPath", "C:\\Windows\\Fonts");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is called.&lt;/P&gt;&lt;P&gt;So I set&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;-DSytemFontPath=/usr/share/fonts/&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but unfortunately that didn't help.&lt;BR /&gt;From earlier tests I know that the search is not recursive and therefore I've tried an existing folder that contains ttf-Files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;-DSystemFontPath=/usr/share/fonts/truetype/dejavu/&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and with this path I don't get a NullPointerException even if the java.home/lib/fonts does not exist. &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;BR /&gt;Now I've added a configuration to our app to specify font-directories, collect all folders containing ttf-Files and set the system-property programatically.&lt;/P&gt;&lt;P&gt;Thank you very much for pointing me in this direction.&lt;/P&gt;&lt;P&gt;[edit]&lt;BR /&gt;Maybe I did something wrong - I have the NPE again. Currently I need at least one ttf-File in java.home/lib.fonts&lt;BR /&gt;But fonts are also loaded from SystemFontPath&lt;BR /&gt;[/edit]&lt;/P&gt;&lt;P&gt;[edit2]&lt;BR /&gt;I only get the NullPointerException if the reports uses a fonts that is not available in&amp;nbsp;SystemFontPath.&lt;BR /&gt;An untouched JRE/JDK is much more better than a rare NullPointerException that can be fixed with adding the correct folders to the SystemFontPath&lt;BR /&gt;[/edit2]&lt;/P&gt;&lt;P&gt;A more rubust solution from Crystal Reports would be better of course but for now this is a workaround I can live with it.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2024 14:04:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/13755744#M4836189</guid>
      <dc:creator>c4u_mkoch</dc:creator>
      <dc:date>2024-07-09T14:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid NullPointerException with Crystal Report...</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/14098949#M4913625</link>
      <description>&lt;P&gt;unfortunately since CR4E SP30 the System-Property SystemFontPath was removed.&lt;/P&gt;&lt;P&gt;Instead /etc/fonts/fonts.conf is parsed and all &amp;lt;dir&amp;gt; entries will be used as font-directories.&lt;/P&gt;&lt;P&gt;But since the font-configuration also supports entries in /etc/fonts/conf.d/ all separate configurations are ignored!&lt;/P&gt;&lt;P&gt;The only workaround with the new versions is to copy the ttf-files directly into /usr/share/fonts because this is the default-directory configured in fonts.conf.&lt;/P&gt;</description>
      <pubDate>Mon, 12 May 2025 10:37:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/14098949#M4913625</guid>
      <dc:creator>c4u_mkoch</dc:creator>
      <dc:date>2025-05-12T10:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid NullPointerException with Crystal Reports Java-Libraries on Linux with OpenJDK?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/14391359#M4941751</link>
      <description>&lt;P&gt;wrong comment...&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2026 12:14:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/14391359#M4941751</guid>
      <dc:creator>c4u_mkoch</dc:creator>
      <dc:date>2026-05-07T12:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid NullPointerException with Crystal Report...</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/14391360#M4941752</link>
      <description>added a bug report: &lt;A href="https://community.sap.com/t5/technology-q-a/crystal-reports-java-runtime-fonts-not-correctly-loaded-on-linux/qaq-p/14391355" target="_blank"&gt;https://community.sap.com/t5/technology-q-a/crystal-reports-java-runtime-fonts-not-correctly-loaded-on-linux/qaq-p/14391355&lt;/A&gt;</description>
      <pubDate>Thu, 07 May 2026 12:15:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-avoid-nullpointerexception-with-crystal-reports-java-libraries-on/qaa-p/14391360#M4941752</guid>
      <dc:creator>c4u_mkoch</dc:creator>
      <dc:date>2026-05-07T12:15:03Z</dc:date>
    </item>
  </channel>
</rss>

