The Jeans instability in smoothed particle hydrodynamics