I am using a bash script (myJavaBash.sh) in an application bundle (myJavaJar.app), which starts "java -jar myJarFile.jar" with additional JVM arguments (which work well up to now). My goal is to pass a file name as an argument to the application as well, each time the user opens a file via "open with … myJavaJar.app".
I have tried to implement OpenFilesHandler in the java application and copy an AppleScript-scpt file into the bundle which calls myJavaBash.sh without success.
The last thing I tried just to test all the possibilities was to call osascript in the bash
#!/bin/bash #test: set command line args MY_TITLE="Launching myJavaJarApp" ARGS_MSG="command line args: " osascript <<-EndOfScript set arguments to "" on open theFiles repeat with anItem in theFiles set arguments to arguments & space & (quoted form of POSIX path of anItem) end repeat end open display dialog "$ARGS_MSG" & arguments with title "$MY_TITLE" EndOfScript
Didn't work, the dialog just says $ ARGS_MSG and no arguments, when I open a file with myJavaJar.app.
It seems to me that defining the bash script as CFBundleExecutable "consumes" all AppleEvents.
Or is there a way?