Issue
I want to run my Java Program on my Raspberry Pi, but it needs to continue running even if i close Putty. The Program is running on my Raspberry Pi and it is starting completely fine, but as soon as I close the console the Program stops.
I can tell it stops because after closing There wont be any Logs into the log fille (except the ones from before closing the Putty Terminal)
Currently I tried it with an sh script and this line within it:
nohup java -jar /home/pi/Programms/PantaBot/PantaBot.jar > /var/log/logPantaBot.txt 2>&1 &
and with running the sh script with
sh startScript.sh&
The sh Script:
chmod 777 HandballDBFiller-1.0.0.jar
java -jar HandballDBFiller-1.0.0.jar > ~/Programme/HandballTippspiel/Log.txt
Solution
I recommend using something like screen or tmux - they both allow you to launch "persistent" terminals that you can disconnect and reconnect to later - possibly from somewhere else, without killing processes launched from such terminals.
Answered By - tucuxi Answer Checked By - Willingham (WPSolving Volunteer)