title: Spring Boot executable JAVA_OPTS override with spaces
body: <p>I'm using Spring Boot 1.4.1 to create an executable Unix JAR file (per the instructions <a href="http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html" rel="nofollow noreferrer">here</a>). I'm using a custom .conf file to set the <code>JAVA_OPTS</code> value at run-time. This has been working fine with the following contents:</p>
  
  <blockquote>
    <p>JAVA_OPTS="-Dspring.profiles.active=prod -Dflyway.validate-on-migrate=false -Djavax.net.ssl.trustStore=/var/myapp/truststore.jks -Djavax.net.ssl.trustStorePassword=changeit"</p>
  </blockquote>
  
  <p>I now want to override a parameter that I've got configured in my application.yml file (that's embedded within the JAR). The problem is that the values of this parameter have spaces in them.</p>
  
  <p>I've tried:</p>
  
  <blockquote>
    <p>JAVA_OPTS="-Dmy.param=One Two
    -Dspring.profiles.active=prod -Dflyway.validate-on-migrate=false -Djavax.net.ssl.trustStore=/var/myapp/truststore.jks -Djavax.net.ssl.trustStorePassword=changeit"</p>
  </blockquote>
  
  <p>...and...</p>
  
  <blockquote>
    <p>JAVA_OPTS="-Dmy.param=One\ Two
    -Dspring.profiles.active=prod -Dflyway.validate-on-migrate=false -Djavax.net.ssl.trustStore=/var/myapp/truststore.jks -Djavax.net.ssl.trustStorePassword=changeit"</p>
  </blockquote>
  
  <p>...and...</p>
  
  <blockquote>
    <p>JAVA_OPTS=-Dmy.param=One\ Two
    -Dspring.profiles.active=prod -Dflyway.validate-on-migrate=false -Djavax.net.ssl.trustStore=/var/myapp/truststore.jks -Djavax.net.ssl.trustStorePassword=changeit</p>
  </blockquote>
  
  <p>...and...</p>
  
  <blockquote>
    <p>JAVA_OPTS=""-Dmy.param=One\ Two"
    -Dspring.profiles.active=prod -Dflyway.validate-on-migrate=false -Djavax.net.ssl.trustStore=/var/myapp/truststore.jks -Djavax.net.ssl.trustStorePassword=changeit"</p>
  </blockquote>
  
  <p>But I get various error messages like:</p>
  
  <blockquote>
    <p>Error: Could not find or load main class Two</p>
  </blockquote>
  
  <p>...or...</p>
  
  <blockquote>
    <p>/var/myapp/myapp.conf line 1: Two: command not found</p>
  </blockquote>
  
  <p>I've looked inside the code that's embedded in the top of the JAR file and it seems to be:</p>
  
  <pre><code>arguments=(-Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS -jar $jarfile $RUN_ARGS "$@")
  </code></pre>
  
  <p>...but I'm having trouble working out how to translate this into a JAVA_OPTS value that works</p>