Kastner is best known today as the teacher of chemist Justus von Liebig.
Kastner received his doctorate in 1805 under the guidance of Johann Gottling and began lecturing at the University of Jena. He moved on to the University of Heidelberg and became professor at the University of Halle in 1812. In 1818 he relocated to the University of Bonn. Again he moved on, partly for political reasons, to the University of Erlangen, where he remained for the remainder of his professional life. Liebig, who had come to Bonn to study with Kastner, followed him to Erlangen and received his doctorate in 1822.