The maternal grandmother of Robert and James Haldane, a former great society beauty, looked after the children. The boys two uncles were experienced military men; one a retired Colonel, who later became their guardian, the other a Captain (soon to be Admiral) in the navy. As experienced men of the world they understood the importance of a good education more than most of the Scottish gentry, so they ensured that their nephews received the best they could. They were both sent to the grammar school in Dundee. However, their grandmother died in 1777, so their uncle, Admiral, Viscount Duncan, decided to send them to board at the High School in Edinburgh, which had a good reputation. Two of their classmates were John Campbell, the African missionary and Greville Ewing, the minister of the Independent congregation in Glasgow — men with whom the Haldanes were to be later intimately connected. The boys missed a stable home life, but otherwise they lived an exceedingly privileged one, living like the wealthy gentlemen they were.
After attending the High School of Edinburgh, and distinguishing himself not only by holding a high place in the class, but being foremost in every schoolboy escapade, he went to Edinburgh University, which he attended for three years, until he had completed his studies in Latin and Greek, and gone through the curriculum of logic, metaphysics, mathematics, and natural philosophy. His uncles decided that James should see as much of England as possible before joining the navy, so they sent him on a tour of the north, down to Derbyshire. James was struck by the attitude of the minister in the party, who, as soon as they crossed the border, decided that as they were now out of the jurisdiction of the Presbyterian Church, they could disregard the Lords Day. On his return he left Charles Street, where he had been boarding for seven years, and spent the months before going to sea with his uncle at Lundie House.
The School is now part of Edinburgh University.