// !/test.xml 是表示jar中的test.xml文件
final URL jarUrl = new URL("jar:file:/C:/proj/parser/jar/parser.jar!/test.xml"); final JarURLConnection connection = (JarURLConnection) jarUrl.openConnection(); final URL url = connection.getJarFileURL(); System.out.println(url.getFile());
转载于:https://www.cnblogs.com/sidesky/p/10554075.html