September 12, 2011

Permalink Java Says "No fonts found" on Amazon Linux AMI

Ran into a snag over the weekend and didn't find a single article to help solve this so I will contribute my learnings to the greater good.

I was using JasperReports locally just fine. But when I deployed to my EC2 instance running the Amazon Linux AMI 2011.02, it blew up. Hmmm. This AMI uses the OpenJDK and many point to that as the problem. They tell you to try and install the Oracle JDK and see if it goes away. But that's too much work. Can't we fix this?

Turns out you can. 2 steps:

1. Install the DejaVu font package.

sudo yum install dejavu-lgc*

2. Create a soft link so the place the OpenJDK looks actually exists.

ln -s /usr/share/fonts/dejavu /usr/share/fonts/dejavu-lgc

Turns out the fonts gets intalled into a directory called dejavu, but the /usr/lib/jvm/jre/lib/fontconfig.properties.src points to a non-existant directory called dejavu-lgc. I suppose you could edit the properties file and change there if you like. The link was quicker for me.

Seems like an easy one for Amazon to fix. But they don't seem to understand the problem. Hope this helps.

Posted: 2011-09-12 at 00:05 MST in Geek
Tags: ec2
Related Posts with Thumbnails