How should I run a Java remote worker?

I have created three Java remote workers and during development, I have simply run them from eclipse. Now it’s time to move the workers to production, but how should I run them there?

I’m not very familiar with running java programs directly. I tried creating a jar with dependencies and run them with

java -cp my-woker-jar-with-dependencies.jar

But I have a feeling that it’s not the best idea, especially because when the server gets rebooted, my application won’t restart.

What different options do I have? What is the simplest?

@Joel it’s expected for all the applications when you servers reboot applications won’t bootstrap themselves. You have to build an algorithm to restart the workers using shell scripts

Sorry, I didn’t quite understand that 100%.

It is my expectation that my application will automatically start after a reboot. But yeah, I guess I can script it myself, I was just looking for examples and alternatives for that as I am sure that many, many other people have solved this same problem before me and I am not sure what is a good way to do that.