John Hamilton was born in Woodbrook, Strabane, County Tyrone. He joined the army and was enlisted in the Bengal Infantry. After eighteen years he was transferred to the king's service and was active at the Cape and in the Penninsular War. He was appointed a general and in 1814 became governor of Duncannon fort. He had a baronetcy bestowed on him in 1815 and was subsequently knighted.