whether my print job is successful or not?

hi i am new to java please suggest what is the code for whether my print job is successful or not? that is if any reason of printer problems (cartridge or paper out) the printing process not completed. at that time how can i get in java my print process is successfully completed or not?