title: How to use File.separator for a jar file resource?
body: <p>I am trying to read a property file which is located within a jar file. I want to use File.separator as the application will run on multiple platforms. I am constructing the path as follows:</p>
  
  <pre><code>jarFilePath="jar:file:"+jarFile.getAbsolutePath()+"!"+jarPropertyFilePath; //jarPropertyFilePath is getting loaded from a class which is storing Constant JAR_PROPERTY_FILE_PATH.
  fileURL= new URL(jarFilePath);
  </code></pre>
  
  <p>However, the above works only when jarPropertyFilePath (fixed location of property file within the jar) is given as :</p>
  
  <p>Case 1:</p>
  
  <pre><code>public static final String JAR_PROPERTY_FILE_PATH = "/manifest/patchControl.properties";
  </code></pre>
  
  <p>Case 2:</p>
  
  <p>If I use File.separator as follows, it gives java.net.MalformedURLException: no !/ in spec</p>
  
  <pre><code>public static final String JAR_PROPERTY_FILE_PATH = File.separator+"manifest"+File.separator+"patchControl.properties";     
  </code></pre>
  
  <p>In Case 1 (workds fine), the final URL when debugged was as follows:</p>
  
  <pre><code>jar:file:C:\MyWorkspace\FalconPatchInstaller\.\patches\DS661JDK1.8.jar!/manifest/patchControl.properties
  </code></pre>
  
  <p>In Case 2(not working), the final URL when debugged was as follows:</p>
  
  <pre><code>jar:file:C:\MyWorkspace\FalconPatchInstaller\.\patches\DS661JDK1.8.jar!\manifest\patchControl.properties
  </code></pre>
  
  <p>How can I use the File.separator for the JAR_PROPERTY_FILE_PATH ?</p>