Transversality of homoclinic orbits to hyberbolic equilibria in a Hamiltonian system, via the Hamilton-Jacobi equation