Issue
I want to run Tomcat on Debian 5 Minimal. So I don't need a gui for my OS, it's just a pure Tomcat-Server.
Which packages do I need for my JVM to use Fonts in my applications? Im drawing texts in Graphics2D and am creating PDF-Files in my Java-Project.
Solution
Graphics2D and anything in the java.awt.*
or java.swing.*
packages require a GUI to do its drawing.
This is a problem on most headless servers. You have two options, and try them in this order:
Use the system property "java.awt.headless" and set that to "true"
java -Djava.awt.headless=true
orSystem.setProperty("java.awt.headless", "true");
Install the XWindows Virtual Frame Buffer (xvfb) on your server. This keeps the server headless, but provides the XWindows primitives needed to draw on a virtual screen. It is far from optimized (no graphics acceleration), but it will allow your system to work again.
The java.awt.headless
option was introduced with Java 1.4. See: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/
In the event that does not work, install the XVFB package and configure it to create a virtual frame buffer large enough to do your drawing.
Answered By - Berin Loritsch