Thứ Năm, 15 tháng 10, 2015

Run a java program in Ubuntu on startup.

To run a java program in Ubuntu on startup, there are many way to do.
We can put command line to the /etc/rc.local:

#sudo gedit /etc/rc.local

Then add your command to run java program:

======================================
#!/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 -cp /home/meo/Tools/ICM.jar com.icm.ConnectionManager &

exit 0

====================================== 

Note: & for running the program in background.

Source: http://unix.stackexchange.com/questions/123762/make-a-java-jar-file-jar-run-at-startup

Không có nhận xét nào:

Đăng nhận xét