<p>I am using <code>launcher.gcr.io/google/jenkins2</code> to run jenkins in gcp kubernetes engine.</p>

<p>Everything seems ok except that I get <code>Could not initialize class org.jfree.chart.JFreeChart</code> error for every chart that jenkins attempt to draw. I googled the error and almost everyone solves that with adding <code>-Djava.awt.headless=true</code>. As you can guess I already tried that and it does not work.</p>

<p>Ideas?</p>

<p>One other possible solution/workaround is seen in <a href="https://issues.jenkins-ci.org/browse/JENKINS-39636" rel="nofollow noreferrer">JENKINS issue 39636</a>:</p>
<blockquote>
<p>I installed <code>libxext6 libxrender1 fontconfig libfontconfig</code> but it didn't help. After that I also installed <code>libjfreechart-java</code> but I still have the same problem.</p>
<p>Commenting out the <code>assistive_technologies</code> line in <code>/etc/java-8-openjdk/accessibility.properties</code> solved it.</p>
</blockquote>
<p>You can see that recommendation in <a href="https://stackoverflow.com/users/433558/tianon">tianon</a>'s  <a href="https://stackoverflow.com/questions/21841269/performance-graphs-on-jenkins-causing-could-not-initialize-class-org-jfree-char#comment76900079_41428450">comment of that answer</a>:</p>
<blockquote>
<p>In my case it ended up being <a href="https://bugs.debian.org/798794" rel="nofollow noreferrer">bugs.debian.org/798794</a> (from &quot;<a href="https://askubuntu.com/a/723503/5470">Assistive technology not found error while building <code>aprof-plot</code></a>&quot;).<br />
Adding &quot;<code>RUN sed -i 's/^assistive_technologies=/#&amp;/' /etc/java-8-openjdk/accessibility.properties</code>&quot; to my <code>Dockerfile</code> fixed it. :)</p>
</blockquote>
