  We use semiclassical formalism to optimize a microwave single photon detector
based on switching events of a current biased Josephson junction coupled to a
resonator. In order to detect very rare events, the average time between dark
counts $\tau_{\rm dark}$ should be maximized taking into account that the
switching time $\tau_{\rm sw}$ should be sufficiently small. We demonstrate
that these times can be tuned in the wide range by changing the junction
parameters, and the ratios $\tau_{\rm dark}/\tau_{\rm sw} \sim 10^9$ can be
achieved. Therefore, a junction-resonator arrangement can be used for detecting
extremely low photon fluxes, for instance for searching galactic axions.
