我正在尝试执行cmd命令以从像
这样的Java崩溃应用程序String command = "@upwork.exe --args -url=chrome://crash -disable-web-security -script-url=https://172.27.68.6/pre_alpha/";
Process p = Runtime.getRuntime().exec(command);
问题是命令运行良好并且崩溃了应用程序,但是我失败了
java.io.IOException: Cannot run program "@upwork.exe": CreateProcess error=2, The system cannot find the file specified
我不确定为什么会这样。任何建议都会有很大的帮助
答案 0 :(得分:0)
您的代码正在尝试运行它无法找到的try
{
foo();//throe ApiException
}
catch(ClientException e)
{}
catch(ServerException e)
{}
catch (ApiException e)
{
var ex=ExceptionLocator.Get(ExceptionCode);//use ExceptionLocator to locate your custom exception
throw ex;
}
catch (Exception e)
{
//Always caught here only
}
public abstract class BusinessException : Exception
{
public string Code { get; private set; }
public string ReasonPhrase { get; private set; }
public ClientException(string code, string message) : base(message)
{
Code = code;
ReasonPhrase = message;
}
}
public class ClientException:BusinessException
{
}
public class ServerException:BusinessException
{
}
public static class ExceptionLocator{
static Dictionary<int,BusinessException> locator=new Dictionary<int,BusinessException>();
public ExceptionLocator()
{
locator.Add(400,new ClientException());
locator.Add(500,new ServerException());
....
}
public static BusinessException Get(int code)
{
return locator[code];
}
}
。这个文件存在吗?
答案 1 :(得分:0)
正如您的例外日志所说,The system cannot find the file specified
尝试提供@upwork.exe
文件的完整路径。