简体   繁体   English

通过java程序在IBM云中运行shell命令,将抛出java.io.IOException错误:无法运行program = 13,权限被拒绝

[英]Running a shell command in IBM cloud through java programme throwing error as java.io.IOException: Cannot run program =13, Permission denied

My code here, I want to ececute jmeter shell command in IBM cloud through Java. 我的代码在这里,我想通过Java在IBM Cloud中执行jmeter shell命令。

Runtime run = Runtime.getRuntime();
Process pr = run.exec("./JMeter/apache-jmeter-4.0/bin/jmeter -n 
-t ./JMX/"+FileName+" -l ./JTL/Generate_Dashboard.jtl -e -o 
./Result/"+Name+""");
pr.waitFor();
BufferedReader buf = new BufferedReader(new 
InputStreamReader(pr.getInputStream()));
String line = "";
while ((line=buf.readLine())!=null) {
        System.out.println(line);
    }
  1. You need to launch jmeter.sh script instead of jmeter , it performs environment check, sets up variables, JVM options when it comes to Java 9, etc. 您需要启动jmeter.sh脚本而不是jmeter ,它会执行环境检查,设置变量,涉及Java 9时的JVM选项 ,等等。
  2. You need to ensure that both jmeter.sh and jmeter have execute permissions , ie execute the following command: 您需要确保jmeter.shjmeter都具有执行权限 ,即执行以下命令:

     chmod +x /JMeter/apache-jmeter-4.0/bin/jmeter && chmod +x /JMeter/apache-jmeter-4.0/bin/jmeter.sh 
  3. I don't think you need these dots in your command, to wit you need to amend your command to look like: 我认为您的命令中不需要这些点,因此,您需要将命令修改为:

     Process pr = run.exec("/JMeter/apache-jmeter-4.0/bin/jmeter -n -t /JMX/"+FileName+" -l /JTL/Generate_Dashboard.jtl -e -o /Result/"+Name+"""); 

More information: Five Ways To Launch a JMeter Test without Using the JMeter GUI 详细信息: 在不使用JMeter GUI的情况下启动JMeter测试的五种方法

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 W/System.err:java.io.IOException:无法运行程序“python”:错误=13,权限被拒绝 - W/System.err: java.io.IOException: Cannot run program "python": error=13, Permission denied JavaFX java.io.IOException "uptime": error=13, permission denied - 以普通用户身份运行程序 - JavaFX java.io.IOException "uptime": error=13, permission denied - Running program as regular user 詹金斯错误:java.io.IOException:错误=13,权限被拒绝 - Jenkins Error :java.io.IOException: error=13, Permission denied java.io.IOException: 无法运行程序“...”: java.io.IOException: error=2, No such file or directory - java.io.IOException: Cannot run program “…”: java.io.IOException: error=2, No such file or directory 无法运行程序java.io.IOException - Cannot run program java.io.IOException java.io.IOException:无法运行程序adb.exe CreateProcess error = 5,拒绝访问 - java.io.IOException: Cannot run program adb.exe CreateProcess error=5, Access is denied java.io.IOException:无法运行程序“ scala”:CreateProcess错误= 2, - java.io.IOException: Cannot run program “scala”: CreateProcess error=2, java.io.IOException:Java中的权限被拒绝 - java.io.IOException: Permission denied in Java java.io.IOException: error=13, Permission denied while execution an.exe library - java.io.IOException: error=13, Permission denied while executing an .exe library java.io.IOException:权限被拒绝无法在 Linux 中创建文件 - java.io.IOException: Permission denied cannot create file in Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM