http://extjs2.javaeye.com/blog/268270
- package net.java2000.net;
-
- import java.io.IOException;
- import java.net.JarURLConnection;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.jar.JarEntry;
- import java.util.jar.JarFile;
-
-
-
-
-
-
-
- public class URLGetJarFile {
-
- public static void main(String[] args) {
- try {
-
- URL url = new URL("jar:http://hostname/my.jar!/");
-
-
- url = new URL("jar:file:/c:/almanac/my.jar!/");
-
-
- JarURLConnection conn = (JarURLConnection) url.openConnection();
- JarFile jarfile = conn.getJarFile();
-
-
- String entryName = conn.getEntryName();
-
-
- url = new URL("jar:file:/c:/almanac/my.jar!/com/mycompany/MyClass.class");
-
-
- conn = (JarURLConnection) url.openConnection();
- jarfile = conn.getJarFile();
-
-
- entryName = conn.getEntryName();
-
-
- JarEntry jarEntry = conn.getJarEntry();
- } catch (MalformedURLException e) {
- } catch (IOException e) {
- }
-
- }
-
- }
(#)
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請
點(diǎn)擊舉報。