title: Apache POI missing dynamic library libfreetype.so
body: <p>I use Apache POI to write out a spreadsheet. The problematic line is where I invoke <code>Sheet#autoSizeColumn(int column)</code>. If I run it on a unix shell with no graphical environment, the following exception appears:</p>
  
  <pre><code>Exception in thread "Thread-3" java.lang.UnsatisfiedLinkError: /usr/pkg/java/openjdk7/jre/lib/amd64/xawt/libmawt.so: Shared object "libXext.so.7" not found
  </code></pre>
  
  <p>According to <a href="http://poi.apache.org/spreadsheet/quick-guide.html#Autofit" rel="nofollow">apache's quick guide</a> there is a property which should be set to signalize headless environment, so I try the following call:</p>
  
  <pre><code> java -jar -Xmx200m -Djava.awt.headless=true myJar.jar
  </code></pre>
  
  <p>But I get then another exception for the same line:</p>
  
  <pre><code>Exception in thread "Thread-3" java.lang.UnsatisfiedLinkError: /usr/pkg/java/openjdk7/jre/lib/amd64/libfontmanager.so: Shared object "libfreetype.so.7" not found
  </code></pre>
  
  <p>The above apache guide also says "I should ensure that the fonts I use in your workbook are available to Java". I really don't use any specific fonts, the one and only thing I do with fonts is</p>
  
  <pre><code>XSSFFont boldFont = (XSSFFont) wb.createFont();
  boldFont.setBold(true);
  titleRowStyle.setFont(boldFont);
  </code></pre>
  
  <p>The unix shell runs</p>
  
  <pre><code>openjdk version "1.7.0-internal"
  OpenJDK Runtime Environment (build 1.7.0-internal-pkgsrc_2015_01_06_05_56-b00)
  OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>NetBSD *** 6.1.5 NetBSD 6.1.5 (jajo) #1: Sun Jun 21 09:13:03 UTC 2015  spaj@***:/usr/src/sys/arch/amd64/compile/jajo amd64
  </code></pre>
  
  <p>Is it possible to fix this issue?</p>