The J-invariant for elliptic curves