0

I run a command using java Runtime.That command work fine when i executed normally on terminal/command promp but unable to execute through Java.Runtime :-

        Runtime.getRuntime().exec("fs_cli -H x.x.x.x -x 'fsctl loglevel'");

It give output "-ERR 'fsctl Command not found!"

4

1 回答 1

0

解决错误:-

ProcessBuilder builder = new ProcessBuilder();
System.out.println(new BufferedReader(new InputStreamReader(builder.command("sh", "-c", "fs_cli -H 10.168.3.135 -x 'fsctl loglevel'").start().getInputStream())).lines().parallel().collect(Collectors.joining("\n")));
于 2018-07-19T06:36:05.483 回答