James Lyle was educated at the Free Church Training College, Glasgow, and then studied at the University of Glasgow where he obtained the degree Master of Arts (MA). He soon became a Fellow of the Royal Meteorological Society. In 1897 he came to the Orange Free State (now the Free State) and in December 1903 married Miss A.M. Boyd. In 1901 the University of the Cape of Good Hope admitted him to its MA degree on the basis of his MA from the University of Glasgow. During the Anglo-Boer War (1899-1902) the Orange Freee State came under British control and was renamed the Orange River Colony. Lyle was appointed first assistant science master at Grey College, Bloemfontein, in 1901.
In August 1902 he entered the colony's civil service and the next year was appointed head of a newly established Meteorological Division in the Department of Agriculture. That same year he ordered eight Stevenson screens for housing meteorological instruments. He was also in charge of the colony's central meteorological station at Grey College. An abstract - probably the first - of his meteorological observations covered the period April to June 1903. His first meteorological report covered the period 1 July 1904 to 30 June 1905 and contained data for nine second order stations all over the colony, plus 74 rainfall stations. He remained in charge of the division until the formation of the Union of South Africa in 1910. From 1903 he also provided the results of his observations at the Grey College meteorological station to the Meteorological Commission of the Cape of Good Hope, which included a summary in their annual reports.
In addition to meteorology Lyle was interested in physics and collaborated with Professor J.C. Beattie* of the South African College, Cape Town, in a study of atmospheric electricity. Lyle made observations in Bloemfontein and, as joint author with Beattie and W.H. Logeman*, wrote "A preliminary note on some observations on atmospheric electricity in Cape Town and Bloemfontein", which was presented at the first annual congress of the South African Association for the Advancement of Science in 1903 and published in the association's Report for that year (pp. 102-105). It dealt with their measurements of the variable conductivity of the air by observing the tempo at which an electric charge leaked from an aluminium leaf electroscope. Lyle was an early member of the association and represented Bloemfontein on its Council from 1903 to 1905. In August 1905 the three researchers presented a further short paper on their work at the joint meeting of the British and South African Associations for the Advancement of Science in Cape Town. It was included in the Addresses and papers... published after the meeting as "Observations on atmospheric electricity at Bloemfontein and at Cape Town", by Lyle and Beattie (Vol. 1, pp. 42-44). In 1906 Lyle published a short paper, "Radiation phenomena in South Africa", in the Meteorological Magazine, in which he related incidents of mirages to the positions of hot and cold air near the ground.
After 1904, when Grey University College was seperated from Grey College School (a high school for boys), Lyle became professor of chemistry and physics at the college. In April 1907 he was appointed principal of Grey College School, a position he held until 1921. From June 1910 he served as a member of the management committee of the National Museum in Bloemfontein.
Lyle was an early member of the Philosophical Society of the Orange River Colony (established in 1903) and served on its committee of management to at least 1909. On 3 October 1903 he delivered the first scientific paper before the society, on "Meteorology: Past, present and future work in the Orange River Colony". Two months later he spoke on "Radium and its allied minerals". Summaries of both papers were published in the society's Transactions (1903-1907, Vol. 1, pp. 20-23). He was a member also of the South African Philosophical Society (Cape Town) from 1901, and of its successor, the Royal Society of South Africa, from 1908 to at least 1917.
In 1908 Harvard University conducted an investigation to find a suitable site for an astronomical observatory in South Africa. Lyle corresponded with Professor E.C. Pickering, Director of Harvard Observatory, about possible sites in the Orange River Colony and provided considerable assistance to the resulting expedition lead by S.I. Bailey* which selected a site at Mazelspoort, near Bloemfontein. However, for financial reasons Boyden Observatory, Harvard University's southern observatory, was established on the site only in 1926.