Hi kirill,
Thanks for reply. Actually I am able to run appium server and adb devices command on terminal using java code in mac , but I really don't how to run command with spaces(Eg. ios-deploy -c) on terminal using java code.
Actually I am trying to get list of iPhone devices which are connected to mac machine using java code after that I am sending UDID, device name and device version of iPhone device to capabilities, but I am unable to get the iPhone data. please find the below java code.
Code 1: The below code is nothing displaying in console.
String[] str = {"/bin/bash", "-c", "ios-deploy -c"};
Process p = Runtime.getRuntime().exec(str);
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
String allLine = "";
while((line=r.readLine()) != null)
{
System.out.println(line);
}
Code 2: The below code is displaying IPhone information + Unnecessary data.
String[] str = {"/bin/bash", "-c", "system_profiler", "SPHardwareDataType","| sed -n -E -e '/(iPhone|iPad)/,/Serial/s/ *Serial Number: *(.+)/\1/p'" };
Process p = Runtime.getRuntime().exec(str);
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
String allLine = "";
while((line=r.readLine()) != null)
{
System.out.println(line);
}
ios-webkit-debug-proxy Server:
I am getting below Exception when I trying to run ios-webkit-debug-proxy Server using below java code:
String deviceId = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
Process p = Runtime.getRuntime().exec(new String[]{
"pkill -f ios-webkit-debug-proxy-launcher ios_webkit_debug_proxy",
";",
"nohup node ~/appium/bin/ios-webkit-debug-proxy-launcher.js -c " + deviceId + ":27753 > /dev/null 2>&1 &"
});
java.io.IOException: Cannot run program "pkill -f ios-webkit-debug-proxy-launcher ios_webkit_debug_proxy": error=2, No such file or directory