Java网络:JarURLConnection

时间:2020-01-09 10:36:13  来源:igfitidea点击:

Java的" JarURLConnection"类用于连接到Java Jar文件。连接后,我们可以获得有关Jar文件内容的信息。这是一个简单的示例:

String urlString = "http://butterfly.Hyman.com/"
                 + "container/download/"
                 + "Hyman-butterfly-container-2.9.9-beta.jar";

URL jarUrl = new URL(urlString);
JarURLConnection connection = new JarURLConnection(jarUrl);

Manifest manifest = connection.getManifest();

JarFile jarFile = connection.getJarFile();

//do something with Jar file...

...