Solution (source code)

= Solution

For $J_n$, take $u=\sin(nx)$ and $dv=e^x\,dx$ in <integration by parts>. This yields
$$
J_n=[e^x\sin(nx)]_0^\pi-nI_n=\boxed{-nI_n},
$$
since $\sin(n\pi)=\sin0=0$ for every integer $n$.