title: Reading external javascript file's contents as a java string
body: <p>I am having a scenario where I need to call a java method which takes in a string parameter which is Javascript code to be executed by the method.</p>
  
  <pre><code>executeJavaScript( String javascriptCodeToBeExecuted ) {
  }
  </code></pre>
  
  <p>Right now, here is what I am doing</p>
  
  <pre><code>String javascriptCodeToBeExecuted  = "function example(a,b) {" + 
  "number += a;" +
  "alert(\'You have chosen: \' + b);" +
  "}" ;
  </code></pre>
  
  <p>Since the amount of JS code is overwhelming, I would like to keep all javascript in external files and have my java program read the content as a string. </p>
  
  <p>Is there a clean way of doing this ? Perhaps a library which takes care of escape sequences, etc ? </p>
  
  <p>Thanks !</p>