-
Notifications
You must be signed in to change notification settings - Fork 161
Pass command line arguments through to the application #31
Conversation
Currently, you cannot pass command line arguments to the bundled application. For instance: open MyJavaApp.app --args arg1 arg2 arg1 and arg2 are available in the universalJavaApplicationStub script, but it doesn't forward them in the call to java. This commit just tacks a $@ on the end of the call to exec "$JAVACMD"
…xist Turns out that last commit broke no-argument applications, but only when launched via open. Calling the universalJavaApplicationStub script directly worked fine with or without arguments. Weird. I have no bash scripting experience, so if there's a prettier solution, please fix my fix!
|
Thanks for your contribution. I haven't tested your PR yet, but it looks like the code is missing the |
…f they exist" This reverts commit 4105979. It turns out "open" sometimes passes a "process serial number" argument of the form -psn_X_YYYYYYY to apps when launching them. What little documentation I could find suggests the behavior differs across OS versions and whether or not the app is already open, so it's probably best not to worry about it in universalJavaApplicationStub and let the application handle it if present. Also, use "$@" instead of $@ to preserve argument whitespace. For my app, on MacOS 10.10.5, the extra argument appears to be passed only if open is used without the --args option. My app terminates with a help message when such an unexpected argument is received, but open redirects the output to somewhere I can't find, so the observed behavior was silent termination after the splash screen.
|
You are correct. Sorry about that. I hadn't actually cloned the repo, just copied the file, onto my machine. So I was editing it locally and then reflecting the changes directly on GitHub via it's editor. Poor form, obviously. I have since cloned it to my machine and pushed the latest commit from there. |
|
I'm interested in this topic, because I wrote an application that accepts an argument, i.e. a file to open. Now I wonder how the |
|
@albertus82 The "Open with…" feature works with registering a specific file extension in your Plist file like for example: Jarbundler Ant task: (generated) Plist snippet: |
|
Thanks for your contribution, @dbankieris! |
|
This was added in version 2.0.0 released just today! Thanks for your contribution! 👏 |
|
Hi @tofi86, I upgraded to v2.0.0 but my application won't start anymore :( If I manually open the app folder and start universalJavaApplicationStub, then the app starts along with the terminal window. OS X El Capitan, italian language. |
|
Opening a new issue for that, @albertus82. See #39 |
|
There was a regression in this PR which lead to the bug reported by @albertus82 in #39. |
Currently, you cannot pass command line arguments to the bundled application. For instance:
open MyJavaApp.app --args arg1 arg2arg1andarg2are available in theuniversalJavaApplicationStubscript, but it doesn't forward them in the call to java.This commit just tacks a
$@on the end of the call toexec "$JAVACMD"