Reputation: 79
I want run java application though shell script.The below is my demo shell script.
nohup java -cp .:$CLASSPATH com.xx.xx.App >> path/to/xx.log &
but get this error:
nohup: failed to run command ‘java’: No such file or directory
someone can solve this question? thx!
Upvotes: 2
Views: 12047
Reputation: 79
I solved this question by add this line to my shell script.
source ~/.bashrc
This method is reload system environment. Then shell script can use java command.
Upvotes: 2