Other answers do a good job giving custom scripts and setups depending on your platform. In addition to those, here are the mature, special purpose programs that I know of:
- JSW from TanukiSoftware
- YAJSW is an open source clone from the above. It is written in Java, and it is a nanny process that manages the child process (your code) according to configurations. Works on windows / linux.
- JSVC is a native application. Its also a nanny process, but it invokes your child application through the JNI, rather than as a subprocess.