简体   繁体   中英

Executing shell script through java program

I am trying to execute shell script through java program but the script is not executing completely.

Script:

shell.sh ./MetaMatch.sh songsMetaData.json > songsResult.json

Though it is printing songsResult.json file but empty.

You can use java ProcessBuilder to execute shell script in local machine. You can find lot of example in google one of them is http://esudharaka.blogspot.in/2012/06/executing-shell-script-from-java-class.html . If shell script is in remote host than you have to use libraries like Jsch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM