简体   繁体   中英

Executing shell script from Java

Able to call and execute the shell script when executed in an individual Java Program. But there is no output when called from a Floodlight controller program

The Floodlight controller is executed using java -jar target/floodlight.jar . The command to execute the shell script is provided in one of the source files. When ever the condition matches and code gets executed, the terminal screen appears for a second and vanishes. But this is not the case when I execute the same shell script with Java in an individual program.

Process proc = Runtime.getRuntime().exec(new String[]{"path to shell script", arg1});

Can anybody please comment on this ?

Executing with sudo or in root mode is the culprit. Ran in user mode, worked perfectly.

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