  We investigate the supercurrent through a quantum dot for the whole range of
couplings using the numerical renormalization group method. We find that the
Josephson current switches abruptly from a $\pi$- to a 0-phase as the coupling
increases. At intermediate couplings the total spin in the ground state depends
on the phase difference between the two superconductors. Our numerical results
can explain the crossover in the conductance observed experimentally by
Buitelaar \textit{et al.} [Phys. Rev. Lett. \textbf{89}, 256 801 (2002)].
