Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font 'Arial' is not available to the JVM

I'm working on a Java project that uses Jasperreports. I worked several times in other projects using the same technology, and i had the same problem when trying to print a report in Unix environments.

My project uses:

  • JBoss 4.2.3.GA
  • Java 1.6
  • Jasperreports 4.7.0

The exception thrown is:

net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'Arial' is not available to the JVM. See the Javadoc for more details.

I found a common solution to solve this issue and ir really works:

sudo apt-get install msttcorefonts

However, I want to understand how Jasper works with fonts, and how it searches this fonts installed in Unix environments. Maybe a better question is: how JVM handles native fonts? Can anyone give me a detailed explanation on this subject? How are system fonts made available for the JVM in runtime?

like image 257
gdfbarbosa Avatar asked Sep 14 '12 13:09

gdfbarbosa


Video Answer


2 Answers

Java asks the OS to provide the fonts. How that works depends on the OS.

http://en.wikipedia.org/wiki/Arial states its is installed on MS-Windows and MAC OSX

like image 53
Peter Lawrey Avatar answered Sep 20 '22 21:09

Peter Lawrey


If you don't want to go through the hassle of downloading jars and what not, just go to software-center and click install Ubuntu restricted extras. This package will install not only MS Fonts but other supports for applications with restricted copyright.

This works for Ubuntu Systems.

like image 32
Sanshila Avatar answered Sep 19 '22 21:09

Sanshila