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:
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);
However, the above works only when jarPropertyFilePath (fixed location of property file within the jar) is given as :
Case 1:
public static final String JAR_PROPERTY_FILE_PATH = "/manifest/patchControl.properties";
Case 2:
If I use File.separator as follows, it gives java.net.MalformedURLException: no !/ in spec
public static final String JAR_PROPERTY_FILE_PATH = File.separator+"manifest"+File.separator+"patchControl.properties";
In Case 1 (workds fine), the final URL when debugged was as follows:
jar:file:C:\MyWorkspace\FalconPatchInstaller\.\patches\DS661JDK1.8.jar!/manifest/patchControl.properties
In Case 2(not working), the final URL when debugged was as follows:
jar:file:C:\MyWorkspace\FalconPatchInstaller\.\patches\DS661JDK1.8.jar!\manifest\patchControl.properties
How can I use the File.separator for the JAR_PROPERTY_FILE_PATH ?