I get a jar file url at runtime as:
jar:file:///C:/proj/parser/jar/parser.jar!/test.xml
How can this be converted to a valid path as:
C:/proj/parser/jar/parser.jar.
I have already tried using File(URI)
, getPath()
, getFile()
in vain.
I get a jar file url at runtime as:
jar:file:///C:/proj/parser/jar/parser.jar!/test.xml
How can this be converted to a valid path as:
C:/proj/parser/jar/parser.jar.
I have already tried using File(URI)
, getPath()
, getFile()
in vain.
This might do it, if MS-Windows is not offended by a leading slash:
Some might consider this to be a bit 'hacky', but it'll do the job in that instance and i'm sure it'd perform a damn sight better than creating all those objects in the other suggestions.
Not sure of any exact method that will give you what you want, but this should get you close:
Hope this helps.
I just had to do this.
This solution will handle spaces in the path.
or with a URL object to begin with: