Electronic transport through nanostructures is greatly affected by the presence of superconducting leads. If the interface between the nanostructure and the superconductors is sufficiently transparent, a dissipationless current (supercurrent) can flow through the device due to the Josephson effect. A Josephson coupling, as measured via the zero-resistance supercurrent, has been obtained via tunnel barriers, superconducting constrictions, normal metals, and semiconductors. The coupling mechanisms vary from tunneling to Andreev reflection. The latter process has always occurred via a normal-type system with a continuous density of states. Here we investigate a supercurrent flowing via a discrete density of states, i.e., the quantized single particle energy states of a quantum dot, or artificial atom, placed in between superconducting electrodes. For this purpose, we exploit the quantum properties of finite-sized carbon nanotubes (CNTs). By means of a gate electrode, successive discrete energy states are tuned ON and OFF resonance with the Fermi energy in the superconducting leads, resulting in a periodic modulation of the critical current and a non-trivial correlation between the conductance in the normal state and the supercurrent. We find, in good agreement with existing theory, that the product of the critical current and the normal state resistance becomes an oscillating function, in contrast to being constant as in previously explored regimes.