The man, in his 80s, was convicted last week by a Porrentruy court of attempted sexual acts with children, Le Quotidien Jurassien reported on Wednesday.
The court fined him 720 francs and issued a suspended penalty equivalent to 120 days’ income.
However, the court said the man would go to jail for four months if he does not buy a pair of pants big enough to allow the fly to close.
During the man’s case, the court heard testimony that he had the habit of walking around with his trouser fly open.
This evidence was borne out in the courtroom where the judge noticed the man’s sartorial deficiency.
“It’s because of my trousers, they are too small, ” Le Quotidien Jurassien quoted the octogenarian as saying.
In July 2012, the former farmer was reported for making propositions to a group of school girls after exposing his penis, the newspaper said.
He told the court he just started to unbutton his trousers to scare the girls.
The convicted man had a record of previous similar incidents involving small girls in 2010 and ten years earlier.