-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make .bat start script honor -J and -D arguments. #218
Conversation
Hi @gourlaysama, Thank you for your contribution! We really value the time you've taken to put this together. Before we proceed with reviewing this pull request, please sign the Typesafe Contributors License Agreement: |
I signed the CLA :-) |
Thanks a lot @gourlaysama ! Bat-Gurus are always welcome :) I will try this on windows as I only get the intention of your code (mostly through the comments). Looking at the conversion of scala/scala#2767 everything should be fine. |
set _JAVA_PARAMS=%_TEST_PARAM:~2% | ||
) | ||
|
||
if "%_TEST_PARAM:~0,2%"=="-D" ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, so this loop could do more sorts of arg parsing than just -D vs. -J.
This LGTM. we don't have automated windows tests though, so I may need to check this out manually to try it. |
Okay, I tested this (Windows 7). My App looks like this println(System.getProperty("test", "no value"))
println("Max Memory: " + (Runtime.getRuntime.maxMemory / (1024*1024)) + " Mb") Results for System Properties
Results for jvm propertieseverything worked as expected |
I'll ping you when I update the PR. |
Hum, it seems that the problem with
or
So anyway, that's not really a bug in the bat file. I'll just update the script with proper support for |
This makes the .bat start script parse and use -J and -D arguments. Specifically: - Parameters starting with -J are stripped of the prefix, unquoted if necessary and appended to %JAVA_OPTS%. - Parameters starting with -D are unquoted if necessary and then appended to the others. The right-hand side of a property can be quoted or not. - The exact arguments passed to the script are also given as-is to the main class (using `%*`), so, as before, the main class should ignore arguments starting with -J and -D. This could be improved by manually parsing all arguments (not just -J and -D), but this is a mine field when it comes to quoting and delimiters... This is adapted from my similar contribution to scala 2.10, see scala/scala#2767.
@muuki88 I updated the script. Here is a little summary:
|
Awesome! Thanks a lot for your effort. @jsuereth or I will try to reproduce the results an then merge it. |
ping @muuki88: did you get a chance to test this? |
no! unfortunatly not. Now the 0.7.0 release is out, this is the next thing to test. Sorry for the long delay :/ |
Make .bat start script honor -J and -D arguments.
Sorry for the long delay. Thanks for your bash magic :) |
This makes the .bat start script parse and use -J and -D arguments.
Specifically:
-J
are stripped of the prefix, unquoted ifnecessary and appended to
%JAVA_OPTS%
.-D
are unquoted if necessary and thenappended to the others. The right-hand side of a property can be
quoted or not.
main class (using
%*
), so, as before, the main class should ignorearguments starting with -J and -D. This could be improved by manually
parsing all arguments (not just -J and -D), but this is a mine field
when it comes to quoting and delimiters...
This is adapted from my similar contribution to scala 2.10, see
scala/scala#2767.
I've wanted to do this for some time, so here it is. This is also somewhat related to #155.