Any person held in a community correctional center for the nonpayment of fine only may, upon application, be discharged from such imprisonment by the court by which he was committed or, when the court is not sitting, by any judge thereof, provided such notice of such application and the hearing thereon as the court or judge may direct shall be given to the prosecuting officer of the court.