⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e138. getting a jar file using a url.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
try {
        // Create a URL that refers to a jar file on the net
        URL url = new URL("jar:http://hostname/my.jar!/");
    
        // Create a URL that refers to a jar file in the file system
        url = new URL("jar:file:/c:/almanac/my.jar!/");
    
        // Get the jar file
        JarURLConnection conn = (JarURLConnection)url.openConnection();
        JarFile jarfile = conn.getJarFile();
    
        // When no entry is specified on the URL, the entry name is null
        String entryName = conn.getEntryName();  // null
    
    
        // Create a URL that refers to an entry in the jar file
        url = new URL("jar:file:/c:/almanac/my.jar!/com/mycompany/MyClass.class");
    
        // Get the jar file
        conn = (JarURLConnection)url.openConnection();
        jarfile = conn.getJarFile();
    
        // Get the entry name; it should be the same as specified on URL
        entryName = conn.getEntryName();
    
        // Get the jar entry
        JarEntry jarEntry = conn.getJarEntry();
    } catch (MalformedURLException e) {
    } catch (IOException e) {
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -