The default printer does not return in Windows 10

I upgraded the Windows environment from 8 to 10 and found that the default printer does not return and another one returns instead.

I disabled the option "Let Windows manage my default printer", but still did not get the default printer.

I have the following code:

 private void testPrinter() {
    PrintService[] array = PrintServiceLookup.lookupPrintServices(null, null);
    for(PrintService ps : array){
        System.out.println(ps.getName());
    }

}

In this test, I get a list of printers as follows:

  • Send to one note

  • Microsoft XPS Document Writer

  • HP printer

  • Epson printer (which is installed as my default printer in Windows)

However, in the following test:

 PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
 System.out.println(ps.getName());

I get an HP printer that is not my default printer !!! No matter which default printer I choose, the HP printer always returns

I looked at the java API for the lookupDefaultPrintService method and it says the following:

. null. , , , , . , .

API- Java . , javax.print.defaultPrinter. .

Windows 8 . . ?

+4
1

, Windows 10 , . .

. (regedit.exe), LegacyDefaultPrinterMode DWORD 1 (.). :

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows
+2

All Articles