The motion of a continuum of matter subject to gravitational interaction is
classically described by the Euler-Poisson system. Prescribing the density of
matter at initial and final times, we are able to obtain weak solutions for
this equation by minimizing the action of the Lagrangian which is a convex
functional. Then we see that such minimizing solutions are consistent with
smooth solutions of the Euler-Poisson system and enjoy some special regularity
properties. Meanwhile some intersting links with with Hamilton-Jacobi equations
are found.