This review provides a theoretical basis for understanding the current-phase relation (CPhiR) for the stationary (dc) Josephson effect in various types of superconducting junctions. The authors summarize recent theoretical developments with an emphasis on the fundamental physical mechanisms of the deviations of the CPhiR from the standard sinusoidal form. A new experimental tool for measuring the CPhiR is described and its practical applications are discussed. The method allows one to measure the electrical currents in Josephson junctions with a small coupling energy as compared to the thermal energy. A number of examples illustrate the importance of the CPhiR measurements for both fundamental physics and applications.