He started spending the money, giving gifts to friends, donating to charity and travelling to Eastern Europe to visit his son.
He also gave money to women in Thailand, believed to be ex-girlfriends, and paid for family and friends to fly to Australia to attend his mother's 90th birthday party.
This uncharacteristic extravagance alarmed his third wife, who "might be expected to inherit", the court judgment noted.
Doctors agreed, citing his profligacy as reason to keep him in hospital. They also refused to let his lawyers see him in private.
After J was confined last August, he appealed to the Mental Health Tribunal, which - after a hearing described by his barrister, John Bartos, as "very short and perfunctory" - ruled that he should be detained for the whole of September.
That decision was manifestly inadequate, according to Justice Richard White. In his judgment, which has only just come to light, Justice White said concerns about J's spending could have been addressed by a court order to take over his financial affairs.
Mr Bartos described the case as most unusual. He told the Herald: "J's wife was concerned that he was spending the money too freely or giving it away. In fact, he was not spending huge amounts of money."
"It seems quite an extraordinary situation that on that basis you keep someone locked up in a hospital ... especially when you've got only a couple of months to live."
J died in a hospice in December, by which time he had made peace with his family.