如何从jar:file:/C:/Program%20Files/test.jar!/foo/bar
转到指向File
的{{1}}?
答案 0 :(得分:11)
以下代码适用于我(基于How do I get just the jar URL from a jar: URL containing a "!" and a specific file in the jar?):
URL url = new URL("jar:file:/C:/Program%20Files/test.jar!/foo/bar");
JarURLConnection connection = (JarURLConnection) url.openConnection();
File file = new File(connection.getJarFileURL().toURI())