1

I'm using the Java Nashorn engine to execute commands via Runtime.getRuntime.exec(...) like this:

var imports = new JavaImporter(java.lang);
with(imports){
    Runtime.getRuntime().exec("/Applications/Some App/Contents/MacOS/Some App");
}

The problem ist, that applications or paths with spaces in it are not executed. If the app has no spaces in it, it simply works.

I tried

Runtime.getRuntime().exec("/Applications/Some\ App/Contents/MacOS/Some\ App");

and

Runtime.getRuntime().exec("/Applications/Some\\ App/Contents/MacOS/Some\\ App");

but nothing worked for me.

Does anyone have a hint for me, what I'm doing wrong?
Thanks in advance.

Chris
  • 697
  • 4
  • 17

0 Answers0