0

Flashを起動していくつかのJSFLスクリプトを実行するクロスプラットフォームスクリプトをJavaで作成しています。

この記事を見つけましたOSXのコマンドラインからJSFLを実行する

コマンドラインから動作します

osascript -e 'tell application "Flash" to open posix file "/var/...tmp/sample.jsfl"'

次のように、Javaからは機能しません。

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();

質問は:Mac OS XでJavaからFlashを起動する方法は?

4

1 に答える 1

0

簡単...この記事によると[方法]ターミナルからアプリケーションを起動しますか?

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();

また

String[] commands = new String[]{"open", "-a", "Adobe Flash CS5", jsflFile.getAbsolutePath()};
于 2012-12-06T18:22:06.183 に答える