Launch path is not accessible when trying to run NSTask within XCUITest testing iOS app

113 views Asked by At

When I try to run my .jar file that is located in the project's resources folder I get an exception that says "Launch path is not accessible." I have created a bridge Objective-C file so swift will have access to NSTask interface.

My code source is:

let bundle = Bundle.main
let path = bundle.path(forResource: "/Resources/MyJar", ofType: "jar")

let task = NSTask()
task?.standardOutput = stdout
task?.standardError = stderr
task?.arguments = ["-jar", path, args]
task?.setLaunchPath("/usr/bin/java")
task?.launch()
task?.waitUntilExit()
0

There are 0 answers