I have written a set of RESTful APIs by using Play Framework 2.6.16 in Java. I use dist command to make a zip file, and upzip it on my server which only installed JDK1.8.
This is more like a linux question about how to run a program in the background. You can use nohup to run the command, so that you can logout without killing the application. You can also use tmux or session to achieve the same thing.
Things get more complicated when you want to deploy a new version, and you have to kill the previous version and etc. I’d suggest using Heroku (or a similar platform) if applicable.