Skip to content
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

Java Options with space in them cannot be added #681

Closed
theomega opened this issue Oct 28, 2015 · 4 comments
Closed

Java Options with space in them cannot be added #681

theomega opened this issue Oct 28, 2015 · 4 comments
Labels
documentation Documentation should be extended or updated universal Zip, tar.gz, tgz and bash issues

Comments

@theomega
Copy link

I want to add the following Java-Option to the launcher:

  -XX:OnOutOfMemoryError="kill -9 %p"

I tried the following in the build.sbt:

javaOptions in Universal ++= Seq(
 "-J-XX:OnOutOfMemoryError=\"kill -9 %p\""
)

But this lead into the following command being executed:

  java -Xmx64m -Xms64m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=12345 '-XX:OnOutOfMemoryError="kill' -cp [Classpath] ExampleApp -9 '%p"'

This means that the java option was split on the first space and the rest of the command was inserted at this point which makes the part after the space appear as parameters to the application

I used sbt-native-package version 1.0.3

@theomega
Copy link
Author

Ok, I had some luck with doing the following after removing the javaOptions again:

bashScriptExtraDefines ++= Seq(
  "addJava \"-XX:OnOutOfMemoryError='kill -9 %p'\""
)

This does the correct thing. If this is the intended behaviour, please close the ticket. Perhaps the documentation should be updated.

@muuki88 muuki88 added universal Zip, tar.gz, tgz and bash issues bug labels Oct 28, 2015
@muuki88
Copy link
Contributor

muuki88 commented Oct 30, 2015

The parsing is done by the bash-script, which can be really tricky to fix or debug. You second solution is definitely correct and a way to go. Still the first option should work as well.

If you can spot the error in this line I'm happy to merge a pull request :)

@theomega
Copy link
Author

Thanks for your answer. My overservation is that the thing already breaks in the loadConfigFile method in the bash script: It screws up the spaces already there, so it is already to late in the line you mention....

@theomega
Copy link
Author

theomega commented Nov 3, 2015

Actually, I was wrong, the command posted by me doesn't work correctly due to quoting. This here might work better:

bashScriptExtraDefines ++= Seq(
  "addJava -XX:OnOutOfMemoryError='kill -9 %p'"
)

So removing on level of quotes

@muuki88 muuki88 added documentation Documentation should be extended or updated and removed bug labels Feb 28, 2016
@muuki88 muuki88 closed this as completed May 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation should be extended or updated universal Zip, tar.gz, tgz and bash issues
Projects
None yet
Development

No branches or pull requests

2 participants