I am creating a cross platform script in Java that will start Flash and execute some JSFL scripts.
I found this article Executing JSFL from the Command Line on OS X
Works from command line
osascript -e 'tell application "Flash" to open posix file "/var/...tmp/sample.jsfl"'
Does not work from Java, like this:
String flashExe = "Flash";
String jsflFile = "/var/...tmp/sample.jsfl";
MessageFormat osascriptFormat = new MessageFormat("''tell application \"{0}\" to open posix file \"{1}\"''");
String osascript = osascriptFormat.format(new Object[]{flashExe, jsflFile});
String[] commands = new String[]{"osascript", "-e", osascript};
ProcessBuilder pb = new ProcessBuilder(commands);
pb.start();
Question is: How to start Flash from Java on Mac OS X?
Easy... according to this article [HOW TO] Launch Application from Terminal?
String jsflPath = "/var/...tmp/sample.jsfl";
File jsflFile = new File(jsflPath);
jsflFile.setExecutable(true);
String[] commands = new String[]{"open", jsflFile.getAbsolutePath() };
ProcessBuilder pb = new ProcessBuilder(commands);
pb.start();
or
String[] commands = new String[]{"open", "-a", "Adobe Flash CS5", jsflFile.getAbsolutePath()};