Debian上的Java:可能的致命错误:找不到字体 [英] Java on Debian: Probable fatal error: No fonts found

查看:116
本文介绍了Debian上的Java:可能的致命错误:找不到字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Debian 5 Minimal上运行Tomcat。所以我不需要我的操作系统的gui,它只是一个纯粹的Tomcat-Server。



我的JVM需要哪些软件包才能在我的应用程序中使用字体?我在Graphics2D中绘制文本,并在我的Java-Project中创建PDF文件。

解决方案

Graphics2D和 java.awt。* java.swing。* 包需要一个GUI来绘图。



这是大多数无头服务器的问题。您有两个选项,请按以下顺序尝试:


  1. 使用系统属性java.awt.headless并设置true
    java -Djava.awt.headless = true System.setProperty(java.awt.headless true);


  2. 在服务器上安装XWindows虚拟帧缓冲区(xvfb)。这使得服务器无头,但提供了在虚拟屏幕上绘制所需的XWindows原语。它远未优化(无图形加速),但它将允许您的系统再次工作。


code> java.awt.headless 选项与Java 1.4一起引入。请参阅: http://java.sun.com/developer/technicalArticles/J2SE/桌面/无头/



如果不起作用,请安装XVFB包并进行配置,以创建足够大的虚拟框架缓冲区。


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.

解决方案

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:

  1. Use the system property "java.awt.headless" and set that to "true" java -Djava.awt.headless=true or System.setProperty("java.awt.headless", "true");

  2. 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.

这篇关于Debian上的Java:可能的致命错误:找不到字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆