Reputation: 342
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
Upvotes: 0
Views: 94
Reputation: 512
You can use a program capable of detaching processes such as screen or tmux.
Upvotes: 2
Reputation: 155
Use tmux.
tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.
You can detach the current session and attach to it when connecting through ssh again.
Expect a learning curve - it takes some time to get used to it.
Upvotes: 1