How can I launch a Java application as a service?

Please make sure that you have supplied the -Xrs parameter to the Java executable.