Orignally by James Prescott Joule in 1843. It is on Joule'shis thombstone!
HeJoule did this mechanically, with a weight that dropped driving a "mill" in a calorimeter with water: https://commons.wikimedia.org/wiki/Category:Mechanical_equivalent_of_heat