Ernest John Hamlin was educated at the Merchant Venturers Technical College, Bristol and continued his studies at the University of Bristol, where he obtained the Bachelor of Science (BSc) degree in 1912. He came to South Africa in March that same year to take up an appointment as assistant in electrotechnics at the South African College, Cape Town. The University of the Cape of Good Hope admitted him to its BSc degree on the basis of his degree from the University of Bristol. In October 1913 he resigned his position to work for the municipality of Stellenbosch. There he became town engineer, a post he held until 1927. Among others he conducted research with local distillers into the treatment of distillery effluent in order to reduce pollution of the local rivers. He also constructed a sewerage system for the town. During 1914 to 1916 he served as an examiner in undergraduate physics for the University of the Cape of Good Hope. He also obtained the degree Doctor of Science (DSc) at the University of Bristol.
In November 1927 Hamlin was appointed assistant city engineer of Johannesburg and promoted to city engineer in July 1932, remaining in that position until his retirement in 1947. He played a role in the city's town planning and was particularly concerned with the reduction of sunlight in the city as a result of the increasing height and density of buildings. The treatment of sewage was also one of his special interests and a topic on which he wrote a number of technical papers, including "Investigations on perculating filters" (with H. Wilson; Proceedings of the Institute of Sewage Purification, 1939); "Sewage disposal as a national problem" (The Surveyor (UK), 1946); "The history, development, present, past and future trends of sewage disposal in South Africa" (Institute of Sewage disposal, 1951); and "Sewerage and sewage disposal in sub-tropical countries, with special reference to South Africa and Mauritius" (Proceedings of the Institution of Civil Engineers, 1952). For the latter paper he was awarded the Coopers Hill War Memorial Prize.
During World War II Hamlin assisted the South African military and attained the rank of Lieutenant-Colonel. After his retirement he started a private practice as a consulting engineer and established the firm E.J. Hamlin and Partners. He continued to consult on various major engineering works up to the time of his death.
Hamlin was elected an associate member of the (British) Institution of Civil Engineers in 1919 and became a member in 1925. He was also a member of the (British) Institution of Mechanical Engineers, the Institution of Electrical Engineers and the Institution of Municipal Engineers; vice-president (1946-1951) of the Institution of Structural Engineers; a Fellow of the Royal Sanitary Institute, the Royal Society of Health, and the Royal Institution of Chartered Surveyors; an honorary associate of the Royal Institution of British Architects; and at some time served as president of the Institute of Sewage Purification. In South Africa he became a member of the Royal Society of South Africa in 1913 and was elected one of its Fellows in 1922; served as president of the South African Institution of Civil Engineers in 1933 and of the South African Institution of Engineers in 1934/5; and played a leading role in founding the Transvaal Association of City and Town Engineers. He became a member of the South African Association for the Advancement of Science in 1917 and at its meeting in Johannesburg in 1936 served as president of Section A (which included engineering). His presidential address dealt with "The researches of a city engineer's department" (South African Journal of Science, 1936, Vol. 33).
Hamlin was a man of strong physique and a dominating personality, who had all the skills required to manage the rapid growth of Johannesburg. In September 1928, at Stellenbosch, he married Dorothty Janet Marnham, with whom he had a son and two daughters.