  In this paper, we study the underlying geometry in the classical
Hamilton-Jacobi equation. The proposed formalism is also valid for nonholonomic
systems. We first introduce the essential geometric ingredients: a vector
bundle, a linear almost Poisson structure and a Hamiltonian function, both on
the dual bundle (a Hamiltonian system). From them, it is possible to formulate
the Hamilton-Jacobi equation, obtaining as a particular case, the classical
theory. The main application in this paper is to nonholonomic mechanical
systems. For it, we first construct the linear almost Poisson structure on the
dual space of the vector bundle of admissible directions, and then, apply the
Hamilton-Jacobi theorem. Another important fact in our paper is the use of the
orbit theorem to symplify the Hamilton-Jacobi equation, the introduction of the
notion of morphisms preserving the Hamiltonian system; indeed, this concept
will be very useful to treat with reduction procedures for systems with
symmetries. Several detailed examples are given to illustrate the utility of
these new developments.
