Solution (source code)

= Solution

The <Euler-Lagrange equations> are $\ddot x+\omega^2x=0$ and $\ddot y+\omega^2y=0$. They imply
$$
\dot J=\ddot xy-\ddot yx=0.
$$
Writing
$$
x=A\cos\omega t+B\sin\omega t,
\qquad y=C\cos\omega t+D\sin\omega t,
$$
gives the conserved value
$$
\boxed{J=\omega(BC-AD).}
$$