Originally posted by Rob Prime:
String urlPath = "jar:file://" + path + "!/";
That will create a URL of the root INSIDE the JAR. You need to add just the JAR. Therefore, remove the "jar:" and "!/".
You can also do this a bit more robust, against possibly troublesome paths, by using File: