On 1 April 1914, Hartmann joined the Königlich Preußischen Kadettenkorps (Royal Prussian Cadet Corps) in Oranienstein near Diez. He initially served in the Vorkorps (pre corps) before he transferred to the Hauptkadettenanstalt (Main Military Academy) in Berlin-Lichterfelde on 1 April 1917. There he graduated with his Abitur (diploma) in 1921.