Gleim was born on the 2nd of April 1719 at Ermsleben, near Halberstadt. Having studied law at the university of Halle he became secretary to Prince William of Brandenburg-Schwedt at Berlin, where he made the acquaintance of Ewald von Kleist, whose devoted friend he became. When the prince fell at the battle of Prague, Gleim became secretary to Prince Leopold of Dessau; but he soon gave up his position, not being able to bear the roughness of the Old Dessauer. After residing a few years in Berlin he was appointed, in 1747, secretary of the cathedral chapter at Halberstadt. Father Gleim was the title accorded to him throughout all literary Germany on account of his kind-hearted though inconsiderate and undiscriminating patronage alike of the poets and poetasters of the period. He wrote a large number of feeble imitations of Anacreon, Horace and the minnesingers, a dull didactic poem entitled Halladat oder das rote Buch (1774), and collections of fables and romances. Of higher merit are his Preussische Kriegslieder von einem Grenadier (1758). These, which were inspired by the campaigns of Frederick II., are often distinguished by genuine feeling and vigorous force of expression. They are also noteworthy as being the first of that long series of noble political songs in which later German literature is so rich. With this exception, Gleims writings are for the most part tamely commonplace in thought and expression. He died at Halberstadt on the 18th of February 1803.
Gleims Sämtliche Werke appeared in 7 vols. in the years 1811-1813; a reprint of the Lieder eines Grenadiers was published by A. Sauer in 1882. A good selection of Gleims poetry will be found in F. Muncker, Anakreontiker und preussisch-patriotische Lyriker (1894). See W. Korte, Gleims Leben aus seinen Briefen und Schriften (1811). His correspondence with Heinse was published in 2 vols. (1894/1896), with Uz (1889), in both cases edited by C. Schuddekopf.