From derivation of Hamilton-Jacobi (HJ) equation one can see that it is only applicable for conserved systems, but from some books and Wikipedia one reads the HJ equation as
$$\frac{\partial{S}}{\partial{t}}+H(q,\frac{\partial{S}}{\partial{q}},t)~=~0$$
there is an extra variable $t$ in Hamilton's function. When Hamilton's function explicitly depends on time , this means that energy is not conserved. So where is truth?