title: How to refer a file from jar file in eclipse plugin
body: <p>I have created an eclipse plugin and I wanted to deploy during eclipse runtime. I have below package structure.</p>
  
  <pre><code>com.myplugin
    |
     ---resources
         |
          ---server.bat
  </code></pre>
  
  <p>As part of the plugin job, "server.bat" file should be executed. </p>
  
  <p>I packaged the plugin as .jar file including resouces folder in the binary and placed in to the eclipse "plugins" folder.</p>
  
  <p>Plugin took effect and it does work fine, but I have a problem while executing the "server.bat" file, which is inside the jar that I generated. The error message says:</p>
  
  <blockquote>
    <p>"Windows cannot find "resources\server.bat" make sure you typed name
    correctly and try again"</p>
  </blockquote>
  
  <p>I tried with relative paths and absolute paths, but it didnt work.</p>
  
  <p>Here is the code doing that work:</p>
  
  <pre><code>URL url = Activator.getDefault().getBundle().getEntry("/resources/server.bat");
  
  String fileURL = FileLocator.toFileURL(url).toString();
  
  String commandLine = "cmd.exe /c start " +fileURL;
  
  Process process= Runtime.getRuntime().exec(commandLine);
  </code></pre>
  
  <p>I got the "fileURL" output:</p>
  
  <blockquote>
    <p>file:/D:/Program
    Files/IBM/SDP/configuration/org.eclipse.osgi/bundles/2392/1/.cp/resources/server.bat</p>
  </blockquote>
  
  <p>I am not sure this is correct.</p>
  
  <p>Hope this is clear enough to answer the question.</p>
  
  <p>Alternatively, please suggest some other way, such as creating features to deploy the plugin with folder structure. I haven't tried this option yet.</p>