Launch and Run Java Programs on the Raspberry Pi Without a Persistent Command Window


Desktop shortcut file contents (Example: Launch Program.desktop) should look similar to the following:

[Desktop Entry]
Name=Launch Program
Comment=Launch program
Icon=icon.png
Exec=bash “/srv/Examples/Linux/Scripts/Launch Program.sh”
Type=Application
Encoding=UTF-8
Terminal=true
Categories=None;

Launch program script executed by desktop shortcut should look similar to the following:

# Launch Program
nohup java -jar “/srv/Examples/Program.jar” &

# Sleep for 3 seconds to ensure program has time to launch.
# If this is not done, program never launches before terminal closes.
# Might be because moving a process to the background takes time?
sleep 3s

,

Leave a Reply

Your email address will not be published. Required fields are marked *