We have constructed a microwave detector based on the voltage switching of an underdamped Josephson junction, that is positioned at a current antinode of a {lambda}/4 coplanar waveguide resonator. By measuring the switching current and the transmission through a waveguide capacitively coupled to the resonator at different drive frequencies and temperatures we are able to fully characterize the system and assess its detection efficiency and sensitivity. Testing the detector by applying a classical microwave field with the strength of a single photon yielded a sensitivity parameter of 0.5 in qualitative agreement with theoretical calculations.