使“java -jar file.jar”在启动时运行

使“java -jar file.jar”在启动时运行

您好,我正在运行 kubuntu 13.10 发行版,但我想我的问题非常笼统......如何使 .jar 在系统启动时在后台执行?

答案1

您可以将命令放入文件中/etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

java -jar file.jar &

exit 0

相关内容