I just want to report this in a separate post… I tried to use Runtime.getRuntime.exec() in a java agent on the Mac.
It does not work, and since the Java debug console does not open, too, I even cannot say what goes wrong.
I just want to report this in a separate post… I tried to use Runtime.getRuntime.exec() in a java agent on the Mac.
It does not work, and since the Java debug console does not open, too, I even cannot say what goes wrong.
Subject: Look in the Mac OS X console
Applications->Utilities->Console.app
If there’s no list of logs in the left hand column, select View->Show Log List
Choose “console messages” from the log list on the left. Java messages should appear there.
Please let us know if there’s any information there.
Subject: more info: it depends on using " in the parameter
I did further research: - Runtime.getRuntime.exec(“/usr/bin/open /tmp/test.odt”) → works
Runtime.getRuntime.exec(“/usr/bin/open “”/tmp/test.odt”“”) → does not work
Runtime.getRuntime.exec({/usr/bin/open “/tmp/test.odt”}) → does not work
So it depends on using " in the parameter of the command.
Question is: how do I write filenames having a space as parameter?
For example, I want to open the file “/tmp/test one.odt”.
I tried the following:
Runtime.getRuntime.exec({/usr/bin/open /tmp/test one.odt})
Runtime.getRuntime.exec({/usr/bin/open /tmp/test\ one.odt})
Runtime.getRuntime.exec({/usr/bin/open /tmp/test\ one.odt})
Runtime.getRuntime.exec({/usr/bin/open /tmp/test\\ one.odt})
without luck, neither of them works.
Any suggestions?
Subject: One suggestion…
Try:- Runtime.getRuntime.exec(“/usr/bin/open "/tmp/test one.odt"”)
Subject: WORKAROUND found
no, using "test one.odt" does not work.
BUT: writing the filepath as URL with %20 instead of a blank works!
So Runtime.getRuntime.exec(“/usr/bin/open file:///tmp/test%20one.odt”) works fine.
That’s a workaround I can live with until the shell() LS function works on the Mac.