I am able to get the name of printer which I had installed previously on my PC.But now its not physically connected to my pc. How should I check it first before moving to Print(
Another way is to use PowerShell and query:
Get-WmiObject -Query "Select * From Win32_PnPEntity where deviceid like 'USBPRINT\\%' and caption like '%Canon%'"
This way, you get result only if printer is connected.
You can query WMI from Java with many libraries, search "WMI Java library".