【发布时间】:2015-02-11 01:35:10
【问题描述】:
配置:
- 操作系统: CentOS 5.4 版
- Linux: 2.6.18-164.el5
- Java: 1.7.0_25
嗨,
我很难弄清楚为什么我的 Java 应用程序中的打印对话框默认使用了错误的打印机。
lpstat -d 返回“printer_ip0”,printenv 命令不返回 LPDEST 或 PRINTER 变量(据我了解,它们优先于系统默认设置)。
然而,每次我开始打印作业时,首先显示按字母顺序排列的第一台打印机 (printer1),PrintServiceLookup.lookupDefaultPrintService().getName() 给出相同的结果。
编辑:
启用 IPP 调试 (System.setProperty("sun.print.ippdebug", "true")) 时,我收到以下日志:
CUPSPrinter>> libfound false
UnixPrintServiceLookup>> total# of printers = 2
CUPSPrinter>> libfound false
CUPSPrinter>> libfound false
CUPSPrinter>> libfound false
isRunning ? false
CUPSPrinter>> libfound false
这将我带到 sun.print 包中的 CUPSPrinter() 类,特别是:
static {
// load awt library to access native code
java.security.AccessController.doPrivileged(
new sun.security.action.LoadLibraryAction("awt"));
libFound = initIDs();
if (libFound) {
cupsServer = getCupsServer();
cupsPort = getCupsPort();
}
}
不幸的是,它仍然没有告诉我为什么它无法访问本机代码。
任何帮助将不胜感激。
【问题讨论】: