title: How to use phantomjs.binary.path when PhantomJS is embedded inside a jar file?
body: <p>I am using phantomjs for headless browser testing. I call phantomjs from within my java file (MainTest.java). The code runs fine in my local machine. I bundle both the phantomjs.exe and the calling java file inside a jar file (tetsPhantom.jar). </p>
  
  <ul>
  <li>testPhantom.jar
  <ul>
  <li>phantomjs.exe</li>
  <li>MainTest.java</li>
  </ul></li>
  </ul>
  
  <p>On the server, it is failing when it tries to find the phantomjs executable path:</p>
  
  <pre><code>String webDir = LiExportEmails.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm(); // Returns http://myservername.com:8080/testPhatom.jar
  System.setProperty("phantomjs.binary.path", webDir);
  </code></pre>
  
  <p>I have tried setting it to <code>http://myservername.com:8080/testPhatom.jar!phantomjs.exe</code> as well, but it still fails.</p>
  
  <p>What should be the correct path of phantomjs located inside the same jar file as the caller?</p>