title: How to detect JavaFX runtime jar in sbt
body: <p>What I'd like to do is define <code>javaHome</code> in the beginning, either from an environment variable or from a fixed string as a default. Then, later, I would use that string.</p>
  
  <p>This is what I've tried:</p>
  
  <pre><code>javaHome := Some(file("/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home"))
  </code></pre>
  
  <p>and later</p>
  
  <pre><code>unmanagedJars in Compile &lt;+= (javaHome) { fn =&gt; Attributed.blank( fn + "/jre/lib/jfxrt.jar") }
  </code></pre>
  
  <p>I have tried to read the [reference][1] but it's really more complex than Scala itself. Please help.</p>
  
  <p>I can bypass this by having a fixed string in the midst of the build file, but generally I don't like such.</p>
  
  <p>Platform is OS X, sbt 0.12.1, JDK 7u10, Scala 2.9.2</p>
  
  <p><em><strong>Edit:</strong>
  Since I found a solution, I have removed error messages and two further (unsuccessful) tries since they would only confuse.</em></p>