You don't have to measure kinetic energy directly. You know the velocity with which the object was launched, you know its mass, so you simply plug those numbers into your equation. Specifically, the kinetic energy at the top of travel must be zero because velocity is zero. Because total energy in the whole system is neither lost nor gained, all the kinetic energy must be transferred to some other form of energy, in this case potential energy. The kinetic energy "lost" through ascending to a specific height therefore equals the potential energy at that height, for which there is the known formula E=mgh, again, no need to measure directly. Your equation simply doesn't work in the real world.