Java lookupDefaultPrintService()不返回系统默认打印机

Java lookupDefaultPrintService()不返回系统默认打印机,java,printing,Java,Printing,配置: 操作系统:CentOS 5.4版 Linux:2.6.18-164.el5 Java:1.7.0_25 嗨 我很难弄清楚为什么Java应用程序中的打印对话框使用了错误的打印机作为默认打印机 lpstat-d返回'printer_ip0',printenv命令不返回LPDEST或printer变量,据我所知,这些变量优先于系统默认设置 但是,每次启动打印作业时,都会首先显示按字母顺序排列的第一台打印机printer1,并且PrintServiceLookup.lookupDefaultPr

配置:

操作系统: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.setPropertysun.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();
   }
}
不幸的是,它仍然没有告诉我为什么它不能访问本机代码


任何帮助都将不胜感激。

我不知道到底是什么解决了我的问题,但经过yum更新后,它就不见了