Robertson studied in Aberdeen and at Leyden University, from which he graduated in 1749. He continued on to Oxford University, where he studied Hebrew under Thomas Hunt (1696-1774), the Laudian Professor of Arabic.
In 1751, he became Professor of Hebrew at Edinburgh University, supported by a written testimonial from his old Professor at Leyden, the philologist Albert Schultens, who had died the year before. He stayed on as Professor until 1792, a few years before his death. From 1763 until 1785 he was even the University Librarian.
He was a much-respected scholar in his own time, and he wrote such works as Grammatica linguae Hebraeae (1758), The resemblance of Jesus to Moses considered (1765), and Clavis Pentateuchi (1770)
Boswell took Dr Johnson to see the library at Edinburgh University on August 16, 1773, and here they met Robertson. According to Boswell, in Journal of a Tour to the Hebrides, Johnson was "much pleased with the library, and with the conversation of Dr James Robertson, Professor of Oriental Languages, the Librarian."